index match question - search column x for a value matching y

RaviWildcat

Board Regular
Joined
Jun 18, 2010
Messages
124
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi Everyone - I thought I was pretty good with index match until I came across this puzzle.

I've got a pizza table with these columns

BradyFriendsPartridgePizza Type
11Cheese
1Pepperoni
2Garlic
22Sausage

I'm allowing the user to select the name (Brady or Friends or Partridge) in one drop down and the number of guests (1 or 2) in another dropdown.

If the user selects the name Brady and 1, then serve a cheese pizza. If the user selects Brady and 2 it will be a garlic pizza.

If the user selects Partridge and 1 it will be a pepperoni. If it's partridge and 2 then it will be sausage

However!

I would like to use the column number in my index match and not the column name. so, if the user picks brady and 2, I want to select the first column of the pizza table and then look for the value 2, and then look across to see what pizza corresponds. This way I won't need to have multiple IF statements in my formula.

So, I'd have a separate table
namecolumn
Brady1
Friends2
Partridge3

And, if the user selects "Friends" and "2" I'd know to refer to column 2 in my pizza table and then look for the value 2 in that column, and select a sausage pizza.

I can easily write something using multiple if statements "if user selects brady then index (pizza table, match (pizza table [brady], , if user selects friends then index pizza table match friends etc. ) but it just seems so clunky. And, I'm trying to avoid using a macro if a clever formula can solve the issue.

Any ideas?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
How about this?
Book1
ABCDEFG
1BradyFriendsPartridgePizza TypeFriends2
211CheeseSausage
31Pepperoni
42Garlic
522Sausage
Sheet5
Cell Formulas
RangeFormula
G2G2=TOCOL(IFS(F1&G1=A1:C1&A2:C5,D2:D5),2)
 
Upvote 0
Solution
hey that's great and humbling too!

Great because it solves the problem
Humbling because I thought I was pretty good at excel but I had never heard of tocol or ifs!

Thank you!
 
Upvote 0

Forum statistics

Threads
1,223,887
Messages
6,175,199
Members
452,617
Latest member
Narendra Babu D

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