If statement help if A1 contains this then return that

V20agent

New Member
Joined
Jan 24, 2020
Messages
13
Office Version
  1. 2010
Platform
  1. Windows
Hello

I can have any of these values (0,1,2,3,4) in in A1.

how do I Make B1 return the following:
if 0 then return "NS"
if 1 then return "G"
if 2 then return "A"
if 3 then return "R"
if 4 then return "C"

how can i write this formula in one line so that it picks up whatever is in A1 and returns the appropriate in B1?

MANY THANKS!
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
How about
Excel Formula:
=choose(A1+1,"NS","G","A","R","C")
 
Upvote 0
Hi,

Here's one way:

Book3.xlsx
AB
10NS
23R
32A
44C
51G
Sheet861
Cell Formulas
RangeFormula
B1:B5B1=CHOOSE(A1+1,"NS","G","A","R","C")
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
You're welcome, thanks for the feedback.
 
Upvote 0
Actually one more thing that i missed. If A1 is blank then B1 returns blank or leave cell empty. how do i do that?
 
Upvote 0
Add a test for blank:

Book3.xlsx
AB
10NS
23R
3 
44C
51G
Sheet862
Cell Formulas
RangeFormula
B1:B5B1=IF(A1="","",CHOOSE(A1+1,"NS","G","A","R","C"))
 
Upvote 0
Solution

Forum statistics

Threads
1,214,411
Messages
6,119,356
Members
448,888
Latest member
Arle8907

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