Forum Discussion
laurelb2003
Jul 14, 2023Copper Contributor
Trying to write a logical formula
Hi
I'm trying to write a logical formula for the first time and am not succeeding.
The formula needs to work as follows:
if the value is less than 12, then 2.0
if the value is 12 to less than 18, then 1.5
if the value is 18 or more, then 1.25
I appreciate any help that can be offered.
Thank you
6 Replies
- flexyourdataIron Contributor
if the value is less than 12, then 2.0
if the value is 12 to less than 18, then 1.5
if the value is 18 or more, then 1.25
Suppose the value is in cell A1. Here are several options you can try:
1) Using IFS
=IFS(A1<12,2,A1<18,1.5,TRUE,1.25)2) Using nested IF
=IF(A1<12,2,IF(A1<18,1.5,1.25))3) Using XLOOKUP
=XLOOKUP(A1,{0,12,18},{2,1.5,1.25},,-1)- laurelb2003Copper ContributorHi. This isn't actually working. Should A be the letter of the cell number the height is in? I tried that and A and every height is coming out with the same answer
- Detlef_LewinSilver ContributorTry the formulas on a new workbook.
- laurelb2003Copper ContributorThat works. Thank you. I just had to change the True in the IFS to 2.
- Detlef_LewinSilver Contributor
- laurelb2003Copper ContributorThank you. When I try this I get 2 for every value. Is there something else I need to do?