+ Reply to Thread
Results 1 to 2 of 2

Sorting with Blank Cells

  1. #1
    Registered User
    Join Date
    10-25-2007
    Posts
    1

    Sorting with Blank Cells

    I have a list of people, their birthdates and their addresses. There's a column for each (see example below). Clearly, each person only has one birthdate, but several of them have several addresses (vacation homes, etc.). I only typed in their names once (i.e., there's a blank value in the people and birthdate sections in the rows of extra addresses). If I sort the list alphabetically by people's name, the extra addresses end up lumped together by themselves. Is there a way to link the rows that only contain extra addresses to their corresponding person entry so that they don't get lumped together?


    Person | Birthdate | Address
    Tom XXX YYY
    Steve XXX YYY
    Maria XXX YYY
    XXX YYY
    XXX YYY
    Betty XXX YYY

    If I sort by person, the "extraneous" lines get detached from the corresponding person.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    Hi excelentuser,

    I found this code at http://www.mvps.org/dmcritchie/excel/fillempt.htm that might do what you're looking for. I combined three pieces of code:
    1. The code that fills empty cells with the text in the cell above it
    2. The code to sort the selection by the name column (column A)
    3. The code to remove those duplicate text entries created in step 1.

    Prior to running the code you must select your range of data, e.g. A1:C47. Put this code in the worksheet's code module by right-clicking on the sheet tab and selecting View Code. You can then run the code by pressing ALT+F8 and selecting 'Sheet1.FillEmpty' from the list and clicking Run.
    Please Login or Register  to view this content.
    Let us know how that works for you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1