Is it possible to create an if-command from a table?

Copper Contributor

Let's say I have a table like this:

ID

Name

1

James

2

David

3

Jackie

 

I want to have a cell (A4) show me the name of a person based on their ID number shown in another cell (A3).

 

In the A4 cell I write "IF(A3=1;"James";A3=2;"David";A3=3;"Jackie"). That works. 

 

However, the list I am working with is way longer than 3 invidviduals. Is there a easier or quicker way to make such an IF-command without having to write the whole command with A3=1;"James";A3=2;"David".. and so on?

 

Thanks in advance,

Thor

5 Replies

@Thorkild1991 

In D2, you can enter a formula like: 

=LOOKUP)C2,A$2:B$4)

Note that ID's are in A2:A4 and Names are in B2:B4. 

@Twifoo 

 

Hi, I have attached an excel file and looks I do not resonate the result of IF function. Can help?

 

clipboard_image_1.png

 

Rgds..Aziz

Modify your formula to this:
=IF(ISNUMBER(C6)*(C6>2),
C6,
“S”)

Hello@Thorkild1991 

 

If you're using Office 365 or Microsoft Office 2019 version, you can easily deploy the IFS function which will handle multiple nested IF statement in older versions.

 

See an example of the IFS function in the attached caption

 

=CHOOSE(A3,"James","David","Jackie")