Less cumbersome multiple lookup

drluke

Active Member
Joined
Apr 17, 2014
Messages
314
Office Version
  1. 365
Platform
  1. Windows
Based on the data I have in col B, I am attempting to insert a code in col A. Any one of 4 different data items could be in col B.

Is there a formula that is less cumbersome than IF B=Water then A=Bottle or IF B=DAY then A=NIGHT etc... Any advise greatly appreciated!!

[TABLE="class: grid, width: 500, align: right"]
<tbody>[TR]
[TD]COL A[/TD]
[TD]COL B[/TD]
[/TR]
[TR]
[TD]Formula = Bottle or Night[/TD]
[TD]Could be any of Water or Day[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Is this what you have at the moment?
=IF(B1="Water","Bottle",IF(B1="Day","Night"))

Would it be better to use a VLOOKUP?
 
Last edited:
Upvote 0
You can also use a LOOKUP function:
Code:
=LOOKUP(B1,{[COLOR=#ff0000]"Day","Water"[/COLOR];"Night","Bottle"})
Add you can keep adding to that (you said that you have four possible values).
Just note that the values in red (the values you are matching on) must be in alphabetical order.
For more on the LOOKUP function, see: https://www.techonthenet.com/excel/formulas/lookup.php
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,830
Messages
6,181,225
Members
453,025
Latest member
Hannah_Pham93

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