You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

IFERROR (VLOOKUP) on a concatenated field

In a Numbers 09 file, I need to find student records in two tables that have identical values in two specific columns and discrepant values in a specific third column.


Because of difficulties getting an IFERROR (VLOOKUP) formula to function properly, I tried to simplify by concatenating the three columns in a new column in both tables using the formula


=CONCATENATE(A2,S2,T2)


then copy-pasting as values, and making sure the column's cell format was Text.


The following formula works properly.


=VLOOKUP(U2,TABLE1 :: $U$2:$U$2582,1,0)


where column U in Tables 1 and 2 contains concatenated data from the three columns of interest. This formula returns correct values for records that match between the two tables' concatenated column, and returns an error for records that do not match; I determined this by spot checking records in the two tables (Table 2 has almost 1500 records; Table 1 almost 2600).


The following formula, under identical conditions, returns "Not found" for every record.


=IFERROR(VLOOKUP(U2,TABLE1 :: $A$2:$U$2582,21,FALSE),"Not found")


where 21 is the column U containing concatenated values in Table 1.


If I copy-paste cell U2's value in Table 2 to the same cell in Table 1, the IFERROR forumla in Table 2 still returns "Not found."


How come the above VLOOKUP formula returns correct values while the IFERROR formula does not? What am I doing improperly?


Thanks in advance!

iMac, OS X Mountain Lion (10.8.4)

Posted on Dec 10, 2013 8:20 AM

Reply
21 replies

Dec 10, 2013 8:46 AM in response to Barry Fass-Holmes

You are misusing VLOOKUP inthe second formula. VLOOKUP looks for a match in the leftmost column of the range (which in this case would be column A) and returns data from the specified column to the right (which in this case would be the 21st column = column U). It is not finding your value in column A of Table1 so it is returning an error (which you are catching and replacing with "not found").


Why not use your first formula and put the IFERROR stuff around that formula instead?

Dec 10, 2013 8:52 AM in response to Badunit

Hi Badunit,


Thanks for your reply.


Even though I have specified U2 as the search cell, the second formula nevertheless is using column A???


=IFERROR(VLOOKUP(U2,TABLE1 :: $A$2:$U$2582,21,FALSE),"Not found")



http://support.apple.com/kb/PH826


VLOOKUP

(search-for, columns-range, return-column, close-match)

search-for: The value to find. search-value can contain any value type.

Dec 10, 2013 9:12 AM in response to Badunit

Thanks, but I do not understand your reply because it evidently answers a different question than what I asked.


Again, my question to your previous reply…the second formula is using column A (in table 1) to search for the search-for value (U2 in table 2) rather than using column 21 (in table 1) which is what I specified in the formula?

Dec 10, 2013 9:46 AM in response to Wayne Contello

Wayne, thanks for your reply.


You're correct—I don't understand your reply.


If the VLOOKUP formula always uses the leftmost column as the return column, why does the formula require specification of the return column?


http://support.apple.com/kb/PH826

return-column:

A number that specifies the relative column number of the cell from which to return the value. return-column is a number value. The leftmost column in the range is column 1.


The examples from the above KB article include the following.


=VLOOKUP("M", C2:E6, 2) returns dolor


Dolor is in column D, which is column 2 (not column A or 1) in the specified range (C2:E6).


If the formula always uses the leftmost column of the specified range, then wouldn't the answer have been I (from column 1 of the specified range) instead of Dolor (from column 2 of the specified range)?


Just trying to understand…

Dec 10, 2013 9:59 AM in response to Barry Fass-Holmes


If the VLOOKUP formula always uses the leftmost column as the return column, why does the formula require specification of the return column?



You may be confusing the terminology.


=VLOOKUP (search-for, columns-range, return-column, close-match)


'search-for' means the value you will look for in the first column of the columns-range


'return-column' means the column containing the value that you want to retrieve (it doesn't have to be the first column in the range)



SG

Dec 10, 2013 10:03 AM in response to SGIII

Hi SGIII,


Yes, I'm confused by your reply!


I thought I had been using the terminology stated in Apple's VLOOKUP KB article. 🙂


VLOOKUP

(search-for, columns-range, return-column, close-match)

  • search-for: The value to find. search-value can contain any value type.
  • columns-range: A range of cells. range is a reference to a single range of cells, which may contain values of any type.
  • return-column: A number that specifies the relative column number of the cell from which to return the value. return-column is a number value. The leftmost column in the range is column 1.
  • close-match: An optional value that determines whether an exact match is required.
    • close match (TRUE, 1, or omitted): If there’s no exact match, select the column with the largest top-row value that is less than the search value. Wildcards can’t be used in search-for.
    • exact match (FALSE or 0): If there’s no exact match, return an error. Wildcards can be used in search-for.

Dec 10, 2013 10:12 AM in response to Barry Fass-Holmes

Barry,


You left out the line before the information you quoted from the KB:


The VLOOKUP function returns a value from a range of columns by using the left column of values to pick a row and a column number to pick a column in that row.


(My emphasis)


That is where it states that it uses the left column when it lood for the value that you passed in the first argument.

IFERROR (VLOOKUP) on a concatenated field

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.