Forum Discussion
Nefe1930
Feb 23, 2024Copper Contributor
If statement with time.
I'm trying to have a cell that will add text based on what time it is currently. The Nested statement that I have does not put in the text. I have A cell set to Now() I have Cell B with the valu...
Nefe1930
Mar 06, 2024Copper Contributor
ok here is what is going on. The current time is 2:19pm
The if statement is =IF( MEDIAN($D$75:$E$75, NOW() ) =$D$75, "Low",IF( MEDIAN($D$75:$E$75, NOW() ) = NOW(), "Med",IF( MEDIAN($D$75:E$75, NOW() ) = $E$75, "High")))
This is what I'm getting
HansVogelaar
Mar 06, 2024MVP
- roelofknolOct 31, 2024Copper ContributorI was struggling with this too. Your statement worked and solved my problem.
Just so that I understand things properly for next time: does the part of the formula LET(t, MOD(NOW(),1) convert the current time into a number value/format for the IF statement to compare against as opposed to being a date/time format?- HansVogelaarOct 31, 2024MVP
Excel stores dates and times as numbers, with 1 day as unit. In a date/time, the integer (whole number) part of the value represents the date, and the fractional part the time.
NOW() returns the current date AND time.
MOD(NOW(), 1) removes the integer part and leaves only the fractional part, i.e. the time. We can compare this with the times in D75 and E75.
- roelofknolOct 31, 2024Copper ContributorThat makes sense. Thanks for the explanation.
- Nefe1930Mar 07, 2024Copper ContributorThat worked!! thanks