Formula using INDEX and MATCH

Robert_Conklin

Board Regular
Joined
Jun 19, 2017
Messages
173
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I am using the following formula in a spreadsheet to autofill cells with data from another sheet and it works.

=INDEX(Table15[Global ID],MATCH([@Name],Table15[Name],0))

I am using the same formula in another workbook and I keep getting a syntax error.

=INDEX(Table15[SAP DESCRIPTION],MATCH([@SAP #],Table19[SAP DESCRIPTION],0))

Why is the new formula not working?
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi,

Are the 2 ranges you are using the same size? The one in Table15 and the one in Table19? Different sized ranges are a common mistake.

Regards,
Gabor
 
Upvote 0
They are, but the first formula (table15) is in a completely different workbook.
 
Upvote 0
There's a good chance Excel doesn't like the # in the formula. Try this:
=INDEX(Table15[SAP DESCRIPTION],MATCH([@[SAP '#]],Table19[SAP DESCRIPTION],0))

I usually start typing the table references and use Tab to autocomplete based on what Excel offers.
 
Upvote 0
I have and I receive the below error message:

1601885040118.png
 
Upvote 0
That's weird. I have just tried to replicate your table structure (as best as I could, based on your formula) and tried it and it worked for me. What happens if you delete the [@[SAP '#]] argument and start typing [, then select @this row from the dropdown list offered in your formula bar, then continue typing SAP and select the SAP # from the dropdown list again to let Excel auto-complete the reference for you, then you add an additional ] manually? Following these steps, I get [@[SAP '#]], which the formula editor accepts without any error messages
 
Upvote 0
I chose the suggestions that Excel offered and completed the formula. It looks exactly as above and returns an N/A value.

1601886251115.png


I checked the other sheet in the workbook and that SAP number is there. So it should have brought the SAP description over for that SAP #. I am not sure what is going on. I use the same formula in two other workbooks and they work like a champ.
 
Upvote 0
It just occurred to me that you are looking up the SAP number in the SAP description column in Table 19, hence the N/A error. Try referring to a column containing SAP# in Table19.
 
Upvote 0
I want to match the SAP numbers and bring back the SAP Description. Is the formula I used wrong?
 
Upvote 0
The 2nd argument inyour MATCH is wrong, then. Your formula should be something like this (assuming the column containing the numbers in Table19 is actually called SAP #):

=INDEX(Table15[SAP DESCRIPTION],MATCH([@[SAP '#]],Table19[SAP '#],0))

When you use the combination of INDEX and MATCH to accomplish such lookups you should always think of it as the range in the INDEX is your range you want to return values from, the 1st argument of MATCH is the lookup value and the 2nd argument of MATCH is the lookup range (so the lookup value must be found in the lookup range).

Hope it helps.
 
Upvote 0

Forum statistics

Threads
1,215,260
Messages
6,123,926
Members
449,135
Latest member
NickWBA

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top