MrExcel Publishing
Your One Stop for Excel Tips & Solutions

If function based on system time


Posted by Jason on September 04, 2001 12:38 PM

I need a way to have the spreadsheet check the current time each time that it performs a calculation.

The sheet will stay open all day. If the current time is greater than 12 noon, it needs to add 24 hours to another cell. At this point, I'd be happy to get an accurate test that would tell me if the current time was greater than noon.

I need to later reference that test in a mathematical function. So, if it's after noon, I'll get one result....if not, I'll get another.

Any help is appreciated.

Jason


Posted by Eric on September 04, 2001 2:33 PM

=HOUR(NOW())+MINUTE(NOW())/60

This formula
=HOUR(NOW())+MINUTE(NOW())/60
will give you how many hours away from 12AM you are. So 12PM is 12 hours away from midnight. Hope that helps.