Using Named Ranges as the LOOKUP_VALUE in Index-Match Formula

kgardner

New Member
Joined
Sep 3, 2015
Messages
22
Hello All,

I have a database of information with account numbers, product types and balances. Each account number has only 1 product type and the balance changes daily. I have a "product key" which I have listed the different product categories separated by the product types that make them up (i.e. Commercial = 1, 2, 3, 4.. & Consumer = 11, 12, 13, 14...). I named the commercial products types (range A2:a10) "Comm" and the consumer product types (range b2:b10) "Consumer."

I want to transfer all of the Commercial accounts from the primary database (worksheet "Data") to a separate worksheet (worksheet "Commercial") and for this to update automatically upon refresh. This data is no available through access, I have to import from a outside database to excel and then sort.

I have tried many different look-up functions and all have failed, including:

A. This method produces 1 correct result and then repeats
Code:
{=INDEX('Data'!A:A, MATCH(Comm, 'Data'!C:C,0))}

B. This method produces #N/A
Code:
 {=INDEX('Data'!A:A, SMALL(IF('Data'!C:C = "Comm", ROW('Data'!C:C)), ROW('$A$2:A2)))}


To simplify my request: I need to look up the account numbers from a database that match a specific product group, which is made up of a list of possible product types.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Try changing
"Comm"
to
Comm

And I highly recommend NOT using entire column references like A:A in that formula
Instead, restrict it to the actual used area like A$1:A$100
 
Upvote 0
When I remove the quotation marks around Comm in method B I still get #N/A.

Is the formula in method B wrong? Can a VBA code do what I am asking?
 
Upvote 0
Actually I think they're both wrong.
The first one returns a value, but I think it's coincidental
I don't think it's really doing what you think it is (or maybe I don't fully understand what you want it to do)..

I named the commercial products types (range A2:a10) "Comm"A. This method produces 1 correct result and then repeats
Code:
{=INDEX('Data'!A:A, MATCH(Comm, 'Data'!C:C,0))}

B. This method produces #N/A
Code:
 {=INDEX('Data'!A:A, SMALL(IF('Data'!C:C = "Comm", ROW('Data'!C:C)), ROW('$A$2:A2)))}

So comm is a multicell range A2:A10
So your first formula translates to
{=INDEX('Data'!A:A, MATCH(A2:A10, 'Data'!C:C,0))}

What exactly is that supposed to be doing?
I don't think it does what you think it does..
 
Upvote 0
So comm is a multicell range A2:A10
So your first formula translates to
{=INDEX('Data'!A:A, MATCH(A2:A10, 'Data'!C:C,0))}

This is correct. I want excel to use the list of product types that are in cells A2:A10 and match them to the products in cells 'Data'!C:C to return the account numbers stored in 'Data'!A:A.

I have 2 product groups, Commercial & Consumer, each made up of multiple product types. I want all of the Commercial accounts to show on 1 worksheet and all the Consumer accounts to show on a separate worksheet. Maybe sample data will help?

A. Product Key Worksheet
Commercial Product TypesConsumer Product Types
111
212
313
414

<tbody>
</tbody>

B. Data worksheet
Account #BalanceProduct Type
784511321202.153
32165467831.5611
316584632784.002
3156548269,351.001

<tbody>
</tbody>

C. Commercial Worksheet (what I want the final product to be)
Account #BalanceProduct Type
784511321202.153
316584632784.002
3156548269,351.001

<tbody>
</tbody>


The formula I need help on would go into the Commercial Worksheet A2, A3, etc.
 
Upvote 0
ok, well you can't use a multicell range like that then, the lookup value in the MATCH needs to be a single cell.

Try this on the Commercial Worksheet, A2 and Filled Right/Down to B4

=INDEX('Data'!A:A,MATCH($C2,'Data'!$C:$C,0))
 
Last edited:
Upvote 0
That solution only scratches the surface. I have 20,000+ accounts with unique account numbers and repeating product types. The index-match formula as you write it only returns the 1st match between the 'Data' worksheet and 'Product Key' worksheet as well as numerous #N/A values from accounts with consumer product types.

Is there a way for excel to use multiple criteria in a lookup formula the same way you can use multiple criteria in a sumproduct or sumif formula? Again, I am somewhat familiar with VBA if that is viable.
 
Upvote 0
So on the Commercial worksheet, you actually need the formula in column B to return the BALANCE.
You already have the account # in A, and product type in C ?
 
Upvote 0
Column B and column C are not causing me issues. I will use a simple vlookup or index match for those.

The problem I am having lies solely in column A of the Commercial worksheet where I want to list all of the account numbers from the Data worksheet that have a commercial product type, which are listed on the Product Type worksheet.
 
Upvote 0
OK, I think I get it now.

try

=IFERROR(INDEX(Data!A$2:A$5,SMALL(IF(ISNUMBER(MATCH(Data!C$2:C$5,Comm,0)),ROW(C$2:C$5)-ROW(C$2)+1),ROWS($A$2:A2))),"")
 
Upvote 0

Forum statistics

Threads
1,215,363
Messages
6,124,505
Members
449,166
Latest member
hokjock

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