Need help with formula using less than and greater than

Hi, so I’m having an issue with a simple formula:

$if(df(hh:mma)>=12:00AM & df(hh:mma)<=12:59AM, Yes, No)$

This was just a simple test I did of the formula. Basically what I’m trying to do is have text change based on different times of the day. For example, between 12am and 1am I want it to display “Midnight”, between 1am and 4am I want it to display “Late Night” etc.

The issue I’m having is it seems to ignore whatever comes after the & symbol, it displays as Yes but doesn’t change to No once it hits 01:00AM. It just stays as Yes. I tried $if(df(hh:mma)=01:00AM, Yes, No)$ and that worked just fine. But I’m having trouble getting it to work properly with < and >, if anyone could help :slight_smile:


1 Like

Try this:

$if(df(hhmm)>=1200 & df(hhmm)<=1259, Yes, No)$

1 Like

Oh yep that works, thank you!

1 Like

It’s also quite often simpler to use a 24 hour clock. This is exactly the same but a little tidier I think:

$if(df(hh)>=12 & df(hh)<13, Yes, No)$

1 Like

Yes that is much simpler, using a 24h clock seems to have resolved all the issues I was having so I’ll just stick with that, thank you!

This topic was automatically closed 25 days after the last reply. New replies are no longer allowed.