How do I accomplish the following:
I have a cell C5
with various numerical values.
If C5
is less than 30
return 0
in C6
If C5
is greater than 30
return 1hr
in C6
if C5
is greater than 60
return 2hr
in C6
if C5
is greater than 90
return 3hr
in C6
etc..
Best Answer
If we assume that a value of
30
should return0
, then the following formula could be entered into cellC6
:It divides the value found in
C5
by30
, rounds it up to the nearest integer (theCEILING
function), and subtracts1
. This table shows the result of a few selected input values:If instead a value of
30
should return1
, usewhich divides the input value by
30
, and rounds it down to the nearest integer (theFLOOR
function).It will result in the following values: