ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   multiple answers (https://www.excelbanter.com/excel-worksheet-functions/114545-multiple-answers.html)

AndyS

multiple answers
 
In need to us something similar to IF function but to have multiple answers ie
if A3=5 then A5=$9
If A3=6 then A5=$12
IF A3=55 Then A5=$30
Any help would be greatly appreciated

JMB

multiple answers
 
You could use a lookup. As long as the lookup vector is in ascending order
(ie 5,6,55) in A5, enter
=LOOKUP(A3,{5,6,55},{9,12,30})

If you have more numbers to add, you might set up a lookup table. Let's say
C1:D10 is the lookup table. Then
=LOOKUP(A3, C1:C10, D1:D10)

If the lookup vector (or key) isn't in ascending order, look at VLOOKUP.


"AndyS" wrote:

In need to us something similar to IF function but to have multiple answers ie
if A3=5 then A5=$9
If A3=6 then A5=$12
IF A3=55 Then A5=$30
Any help would be greatly appreciated


Bob Phillips

multiple answers
 
Simple If

=IF(A3=5,9,IF(A3=6,12,IF(A3=55,30,"")))

in A5 and format as $ amount.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"AndyS" wrote in message
...
In need to us something similar to IF function but to have multiple

answers ie
if A3=5 then A5=$9
If A3=6 then A5=$12
IF A3=55 Then A5=$30
Any help would be greatly appreciated




Leo Heuser

multiple answers
 
"AndyS" skrev i en meddelelse
...
In need to us something similar to IF function but to have multiple
answers ie
if A3=5 then A5=$9
If A3=6 then A5=$12
IF A3=55 Then A5=$30
Any help would be greatly appreciated


Andy

One more way:

=INDEX({9,12,30},MATCH(A3,{5,6,55},0))


--
Best regards
Leo Heuser

Followup to newsgroup only please.




All times are GMT +1. The time now is 05:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com