Forum Discussion

Vonni95's avatar
Vonni95
Copper Contributor
Jun 02, 2020
Solved

Synch 2 columns

I have a document that, somewhere along the way, has one column of emails that got alphabetically sorted by a colleague but did not synch with the other columns when sorted. So now that email column ...
  • mathetes's avatar
    mathetes
    Jun 04, 2020

    Vonni95 

     

    You need to familiarize yourself with the VLOOKUP function. I'll try to answer your question, but the best way for you to get comfortable with it is to create your own opportunities to use it, to try it out, to learn how to use it. And a way to help in that is to use one of the many Internet resources. Here's one that is good:

    https://exceljet.net/excel-functions/excel-vlookup-function

     

    So you asked: But what is $F$6,5,0? I'm not sure what the 6,5,0 refers to and why it's in the function.

     

    And the first thing I'll say is that it isn't 6,5,0, but $F$6,5,0 and not even just that, but $A$2:$F$6,5,0. So let me break that down and then we'll go back and look further at the full context in which $A$2:$F$6,5,0 appears.

    • the $A$2:$F$6 refers to the range in which the VLOOKUP function finds that which it is looking for.
    • the 5 tells it to look at the fifth column in the range $A$2:$F$6
    • the 0 tells it to look for exactly the value that has been entered as the first argument in the VLOOKUP function.

     

    Here then is the  basic VLOOKUP formula without its being nested in the IF function (more on that to follow).

    • VLOOKUP(A2,'Emails Sorted Alphabetically'!$A$2:$F$6,5,0)   And each argument there is as follows:
    • A2 refers to the content of cell A2 (in this case it is Company ID), and it's this value that is going to be used to find the desired row in the range that follows, where the desired answer resides
    • 'Emails Sorted Alphabetically'!$A$2:$F$6 refers to the range in which the lookup function is going to search first for the value in A2, in this case looking in a different tab, that named 'Emails Sorted Alphabetically'!   (the exclamation point is added as part of the syntax when referring to a different sheet by name)
    • and from there, the 5 and 0 operate as noted above.

     

    Now let's put all that in context:

    =IF(VLOOKUP(A2,'Emails Sorted Alphabetically'!$A$2:$F$6,5,0)='Original Unsorted '!E2,'Original Unsorted '!E2,VLOOKUP(A2,'Emails Sorted Alphabetically'!$A$2:$F$6,5,0))

    The IF function basically is saying, "Do the lookup and compare the address you find with what you find with the address in the original unsorted tab. IF they're the same, keep what's there in the original. ELSE put in the new.

     

    Again, I'd refer you to that ExcelJet site to do some research on the IF function as well.

     

    You also asked

     

    1. If I have 16 columns in my sheet, I only need 1 helper column in total right (for the email column)? Not 1 helper column for EACH of the 16 columns?
    2. where do I insert the functions?

    And the answers are

    1. Yes, you only need one "temporary helper column" IF it's only the email address column that is sorted so as to be out of synch with everything else.
    2. It doesn't matter where you put that helper column because you're going to delete it once you've gotten the email addresses correctly aligned with the rest of the content in the row and copied and pasted them (using "Paste Special....Values) into the column where they belong. You could insert one column directly adjacent to the sorted/incorrect column, or you could place it at the end of all the other columns. You just need to make sure that the various references in the IF(VLOOKUP.....)) are correct.

    I'd be happy to write the correct formula for you if you choose to post the actual format of your actual sheets, having first rendered any personal info anonymous. But see if you can follow my descriptions above. Just create a backup sheet first. You can't then "break something" any more than it's already broken. 😉

     

Resources