ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   return a value based on a range (https://www.excelbanter.com/excel-worksheet-functions/47606-return-value-based-range.html)

Michael NYC

return a value based on a range
 
I want to return a value (a number) based on a number in anotehr cell that is
within a range of numbers using the IF function. For example: A2=$75 if B2=5,
A2=$100 if B2=10, A2=$150 if B2=15.

Can someone please give me the correct syntax, I am really lost!


Anne Troy

=if(A2-75,5,if(a2=100,10,if(a2=150,15)))
If you have many more, you can use a vlookup table, which will be nice if
your values ever change.
See:
http://www.officearticles.com/excel/...soft_excel.htm
************
Anne Troy
www.OfficeArticles.com

"Michael NYC" <Michael wrote in message
...
I want to return a value (a number) based on a number in anotehr cell that
is
within a range of numbers using the IF function. For example: A2=$75 if
B2=5,
A2=$100 if B2=10, A2=$150 if B2=15.

Can someone please give me the correct syntax, I am really lost!




Roger Govier

Hi Michael

Try entering in A2
=IF(B2=15,150,IF(B2=10,100,IF(B2=5,75,"")))
This assumes that you want nothing in cell A2 if B2 is not equal to any of
those values.

Or without IF statements
=75*(B2=5)+25*(B2=10)+75*(B2=15)
The formula will return 0 if B2 does not equal 5,10 or 15

Regards

Roger Govier


Michael NYC wrote:
I want to return a value (a number) based on a number in anotehr cell that is
within a range of numbers using the IF function. For example: A2=$75 if B2=5,
A2=$100 if B2=10, A2=$150 if B2=15.

Can someone please give me the correct syntax, I am really lost!


Roger Govier

Correction
That should have read
Or without IF statements
=75*(B2=5)+25*(B2=10)+150*(B2=15)

Regards

Roger Govier


Roger Govier wrote:
Hi Michael

Try entering in A2
=IF(B2=15,150,IF(B2=10,100,IF(B2=5,75,"")))
This assumes that you want nothing in cell A2 if B2 is not equal to any
of those values.

Or without IF statements
=75*(B2=5)+25*(B2=10)+75*(B2=15)
The formula will return 0 if B2 does not equal 5,10 or 15

Regards

Roger Govier


Michael NYC wrote:

I want to return a value (a number) based on a number in anotehr cell
that is within a range of numbers using the IF function. For example:
A2=$75 if B2=5, A2=$100 if B2=10, A2=$150 if B2=15.

Can someone please give me the correct syntax, I am really lost!



All times are GMT +1. The time now is 10:01 PM.

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