Home > Software design >  Get if statement to return value closest to the number
Get if statement to return value closest to the number

Time:11-17

I am building a calculator and need the below if statement to return numbers according to this logic, when I drag this formula down it returns 10 for my subsequent rows, how do I fix this issue?

Tried below:

=IF(OR(D5>=60,1,1),IF(OR(D5>=120,2,2),IF(OR(D5>=180,3,3),IF(OR(D5>=240,4,4),IF(OR(D5>=300,5,5),IF(OR(D5>=360,6,6),IF(OR(D5>=420,7,7),IF(OR(D5>=480,8,8),IF(OR(D5>=540,9,9),IF(D5>=600,10,10))))))))))

CodePudding user response:

delete everything in column where you put this formula and paste it in row 5 of that column

=INDEX(IFNA(VLOOKUP(D5:D, {SEQUENCE(10, 1, 60, 60), SEQUENCE(10)}, 2, 1)))
  • Related