+ Reply to Thread
Results 1 to 4 of 4

Sorting imported values against a master column

  1. #1
    Registered User
    Join Date
    03-08-2009
    Location
    NC
    MS-Off Ver
    Excel 2007
    Posts
    2

    Sorting imported values against a master column

    This problem involves comparing an incomplete column against a complete master column, then sorting the corresponding values to their correct rows. Column 1 is text, column 2 is decimal, 2 places.

    PRESORT
    Sheet 1 ______ Sheet 2_______
    1 2 1 2
    93100 25.00 93100 27.00
    93101 37.00 93102 36.00
    93102 16.00 93103 11.00
    93103 14.00 * notice that 93101 is missing
    G0010 20.00

    Sheet 2 columns 1 and 2 are imported to sheet 1 as columns 3 and 4 as below.

    POSTSORT
    Sheet 1 ______________________
    1 2 3 4
    93100 25.00 93100 27.00
    93101 37.00
    93102 16.00 93102 36.00
    93103 14.00 93103 11.00
    G0010 20.00

    Thanks, rdough

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Sorting imported values against a master column

    I would use two simple formulas to transfer the data.

    In Sheet1 C1 enter this:

    =IF(COUNTIF(Sheet2!$A:$A,$A1)>0,$A1,"")

    In D1 enter this:

    =IF(C1="","",INDEX(Sheet2!$B:$B,MATCH(C1,Sheet2!$A:$A,0)))

    Copy those two cells over and your data will appear in the proper positions.

    To make the data permanent, just highlight it all, CTRL-C, then EDIT > Paste Special > Values over the top of itself.
    Last edited by JBeaucaire; 03-08-2009 at 08:19 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    03-08-2009
    Location
    NC
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Sorting imported values against a master column

    JB, still struggling with this but can usually figure things out eventually. I'll repost when done. Thanks, rdough

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Sorting imported values against a master column

    If it would be easier, post a small sample data set and I'll show you how to do that on the actual data.

+ 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