+ Reply to Thread
Results 1 to 17 of 17

Sorting Values of Two Columns

  1. #1
    Forum Contributor
    Join Date
    10-10-2015
    Location
    nj
    MS-Off Ver
    Office 2021
    Posts
    203

    Sorting Values of Two Columns

    Hi guys,

    Have 2 columns in the attached.

    Pretty simple, I am trying to find what values are in BOTH column A and B.

    Please see attached.

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Sorting Values of Two Columns

    ****deleted*****
    Last edited by JieJenn; 10-21-2016 at 12:25 PM.

  3. #3
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sorting Values of Two Columns

    d2 =iferror(match($B3,$A$2:$A$233,0)>=1,"") and filter on true.

    OK this is not the whole solution since it only looks in column B.

    I will post a revisted one later on.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: Sorting Values of Two Columns

    You could use conditional formatting:

    =NOT(ISNA(VLOOKUP(A2,$B$2:$B$233,1,FALSE))) for column A and

    =NOT(ISNA(VLOOKUP(b2,$a$2:$a$116,1,FALSE)))
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Forum Contributor
    Join Date
    10-10-2015
    Location
    nj
    MS-Off Ver
    Office 2021
    Posts
    203

    Re: Sorting Values of Two Columns

    Quote Originally Posted by Glenn Kennedy View Post
    You could use conditional formatting:

    =NOT(ISNA(VLOOKUP(A2,$B$2:$B$233,1,FALSE))) for column A and

    =NOT(ISNA(VLOOKUP(b2,$a$2:$a$116,1,FALSE)))
    I was looking to have the values that are NOT in both column A and B to paste over to column D.

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: Sorting Values of Two Columns

    That's not what you asked for at Post 1!!!

  7. #7
    Forum Contributor
    Join Date
    10-10-2015
    Location
    nj
    MS-Off Ver
    Office 2021
    Posts
    203

    Re: Sorting Values of Two Columns

    Quote Originally Posted by Glenn Kennedy View Post
    You could use conditional formatting:

    =NOT(ISNA(VLOOKUP(A2,$B$2:$B$233,1,FALSE))) for column A and

    =NOT(ISNA(VLOOKUP(b2,$a$2:$a$116,1,FALSE)))
    I was looking to have the values that are NOT in both column A and B to paste over to column D.


    My mistake, though that was a given.

  8. #8
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Sorting Values of Two Columns

    I was looking to have the values that are NOT in both column A and B to paste over to column D.


    My mistake, though that was a given.
    That would be near infinite.

    Possibly numbers in A not in B or the other way around?
    Dave

  9. #9
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Sorting Values of Two Columns

    Not sure what you want.

    Here are 3 possibilities. All are array entered.

    If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter. Then fill down until you get blanks.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    In A not B
    In B not A
    Both A & B
    =IFERROR(INDEX($A$2:$A$116,SMALL(IF(ISNA(MATCH($A$2:$A$116,$B$2:$B$233,0)),ROW($A$2:$A$116)-MIN(ROW($A$2:$A$116))+1),ROWS($2:2))),"")
    =IFERROR(INDEX($B$2:$B$233,SMALL(IF(ISNA(MATCH($B$2:$B$233,$A$2:$A$116,0)),ROW($B$2:$B$233)-MIN(ROW($B$2:$B$233))+1),ROWS($2:2))),"")
    =IFERROR(INDEX($B$2:$B$233,SMALL(IF(ISNA(MATCH($B$2:$B$233,$A$2:$A$116,0)),"",ROW($B$2:$B$233)-MIN(ROW($B$2:$B$233))+1),ROWS($2:2))),"")
    Last edited by FlameRetired; 10-21-2016 at 03:21 PM.

  10. #10
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sorting Values of Two Columns

    Had no time left yesterday.

    another approach.

    copy column A to column E

    copy column B to column E (below the earlier copied data)

    After that => data => remove duplicate.

    See the attached file.

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: Sorting Values of Two Columns

    This array formula merges the two lists, removing duplicates (so... if a value occurs more than once in the source data, it appears only once in the results: if value x appears on both lists it will appear once in the results

    Flame's formulae differ in that if a value appears in column B, it is EXCLUDED from the column A list (and vice versa). So if a value occurs on both lists it will not appear ANYWHERE in the results.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: Sorting Values of Two Columns

    oh yes... and to stop the results going into scientific notation, apply custom formatting to the cells: 0

  13. #13
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Sorting Values of Two Columns

    I'm still not certain of my interpretations.

    I used a simplified small number example. (I am not able to make the method I used here work with such large numbers.)

    In column C the range of numbers from MIN to MAX of A and B.
    In column D a complete list of all A and B.
    In column E a list of numbers in the range, but not found in A or B.

    Does this represent what you mean?



    Row\Col
    A
    B
    C
    D
    E
    1
    A
    B
    Range of Numbers All Numbers Missing Numbers
    2
    37
    35
    30
    30
    31
    3
    45
    32
    31
    30
    34
    4
    35
    45
    32
    30
    36
    5
    43
    45
    33
    32
    39
    6
    33
    42
    34
    32
    44
    7
    38
    32
    35
    32
    46
    8
    32
    40
    36
    33
    9
    30
    42
    37
    35
    10
    47
    41
    38
    35
    11
    47
    30
    39
    37
    12
    37
    30
    40
    37
    13
    41
    38
    14
    42
    40
    15
    43
    41
    16
    44
    42
    17
    45
    42
    18
    46
    43
    19
    47
    45
    20
    45
    21
    45
    22
    47
    23
    47

  14. #14
    Forum Contributor
    Join Date
    10-10-2015
    Location
    nj
    MS-Off Ver
    Office 2021
    Posts
    203

    Re: Sorting Values of Two Columns

    Flame, had to look up this thread again and ran into a problem with the formulas. I was trying to apply all 3 (see attached). For some reason the total values in A and B is not equaling the total amount of cells in columns D, E, F. They should match up identical. Any idea?
    Attached Files Attached Files

  15. #15
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sorting Values of Two Columns

    Why did you not replied on the offered solution in oktober 2016?

    Flame, had to look up this thread again
    You get better help if you not excluding forummembers for helping you.

  16. #16
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: Sorting Values of Two Columns

    Take a look here. The numbers all match up.

    Your logic is incorrect, however. the total sorted number is A only plus B only plus two times the number of unique values in both columns
    Attached Files Attached Files

  17. #17
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Sorting Values of Two Columns

    Withdrawn by FR.
    Last edited by FlameRetired; 09-17-2017 at 06:06 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Sorting different values from different columns
    By Duco63 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-12-2016, 08:54 AM
  2. Sorting Columns by Specific Values
    By Tony Morgan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-24-2012, 09:43 AM
  3. sorting two columns and write the sorted values on two columns in a different sheet
    By virsojour in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-22-2010, 04:38 AM
  4. Replies: 5
    Last Post: 12-06-2009, 08:10 PM
  5. Sorting Columns With Common Values
    By think_lenovo in forum Excel General
    Replies: 2
    Last Post: 11-25-2009, 07:07 PM
  6. Sorting values from two columns
    By Hawk80 in forum Excel General
    Replies: 2
    Last Post: 02-14-2007, 05:35 AM
  7. Replies: 0
    Last Post: 05-14-2005, 03:19 PM

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