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...
flexyourdata
Jul 14, 2023Iron 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)
laurelb2003
Jul 14, 2023Copper Contributor
That works. Thank you. I just had to change the True in the IFS to 2.