If statement

Z

Zack

In cell H4 I want one of three model numbers to appear. Each model number is
assigned a value, so 1112111 will equal HRV019SB1. So the formula for H4 is,
as of now, =IF(H4=1112111,"HRV019SB1"). And that works great if 1112111
appears. How do I write the formula for multiple values, so if 2112111
appears, a different model number will be shown.

Here's my example
1112111=HRV019SB1
2112111=HRH019SB1
1113111=HRV024SB1
 
J

JBeaucaire

You can stack the IF statements all into one:

=IF(H4=1112111,"HRV019SB1",IF(H4=2112111,"HRH019SB1",IF(H4=1113111,"HRV024SB1","not found"))).

That works, but you can only go 7 deep that way on Excel 2003. You could
build a lookup table in a formula as long as you remember to keep the numeric
values in ascending order, like so:

=LOOKUP(H4,{1112111,1113111,2112111},{"HRV019SB1","HRV024SB1","HRH019SB1"})
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top