Cell Value

chad32

New Member
Joined
May 18, 2008
Messages
7
Hi. In Column A I have a number of differnet country codes and for 2 of them I want to change the value in Column B. For Example if cell A1 is = to "SHA" I want cell B2 to be "SHANGHAI". If cell A1= to "SGN" I want B1 to be = to "HO CHI MINH". If cell A1 is = to anything else I want the value to B2 to remain unchanged.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Try something like =CHOOSE(1+(A1="SHA")+2*(A1="SGN"),B1,"Shanghi","Ho Chi Minh")
 
Upvote 0
try
=IF(OR(A2={"SGN","SHA"}),LOOKUP(A2,$K$2:$L$3),A2)

or equivalent

=IF(OR(A4={"SGN","SHA"}),LOOKUP(A4,{"SGN","HO CHI MINH";"SHA","SHANGHAI"}),A4)

Revise ranges as necessary
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,434
Members
448,961
Latest member
nzskater

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