How to do this IF?

bpflyr

Board Regular
Joined
Nov 7, 2005
Messages
116
I have a list of about 200 rows with different 3 letter codes. There are about 150 different codes. How can I get Excel to:

If B1=TEB then return "Teterboro, NJ" in cell D1.
If B1=LGA then return "New York, NY" in cell D1.

So forth and so on for all 150 different code posibilities.

I will be entering the data in column B, but need Excel to return the answer in D.

How do I or can I do this?? Thank you so much in advance.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
a quick way would be on a separate sheet to put the 3 letter codes in one column and the place names beside them in a second column

Then do a Lookup based on the value in B1 returning the answer to D1

eg;
=LOOKUP(B1, range of values to lookup , range of values to return )
 
Upvote 0
I would go with Fat Cat's idea... it would be easier to modify as well
 
Upvote 0
Fat Cat said:
a quick way would be on a separate sheet to put the 3 letter codes in one column and the place names beside them in a second column

Then do a Lookup based on the value in B1 returning the answer to D1

eg;
=LOOKUP(B1, range of values to lookup , range of values to return )

And sort the 2-column table (say in F2:G100) on its first column if you want to invoke a LOOKUP formula. BTW, such a formula needs to be carefully crafted:

=LOOKUP(B1,$F$2:$F$10,$G$2:$G$100)

if B1 is selected from a dropdown list, constructed from the first column of the sorted table. Otherwise:

=IF(LOOKUP(B1,$F$2:$F$10)=B1,LOOKUP(B1,$F$2:$F$10,$G$2:$G$100),"Not Found")
 
Upvote 0

Forum statistics

Threads
1,213,517
Messages
6,114,089
Members
448,548
Latest member
harryls

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