[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
Solved

# Calculate time difference between stored time and Now() in a cell with Excel 2010

Posted on 2012-08-29
Medium Priority
1,370 Views
I need help in creating an Excel formula to display “True” if the Now() time is greater than the stored Date/Timestamp by 8 hours.

----[C] Start Time            | [D] Over 8 hrs
[C2] – 8/28/12 16:21      | [D2]   “True”

If the time is Less Than 8 hours show  “” in column D, else show "True"
I’ve tried a few formulas but I not too familiar how to use the IF statement
0
Question by:edrz01
• 5
• 3

LVL 34

Accepted Solution

Rob Henson earned 2000 total points
ID: 38345721
In D2:

=IF(C2<NOW()-(8/24),"True","")

Thanks
Rob H
0

LVL 34

Expert Comment

ID: 38345780
To explain:

IF ( Condition, True Result, False Result)

Condition: C2 < NOW() - (8/24) -- NOW() as you've worked out gives current date and time. Excel stores dates and times as a numerical serial number. The date is the integer part of the number, 01/01/1900 being 1 and 29 Aug 2012 being 41150. The time is then the decimal part of the number, hence 8 hours being 8/24.

Logic - "Start Date & Time is less than (or prior to) NOW() - 8/24" i.e. difference between date/time and now is greater than 8 hours.

True Result - "True"
False Result - "" representing blank.

If you wanted True or False, rather than True or blank, you wouldn't have to use the IF statement. You could just use:

=C2<NOW()-(8/24)

Thanks
Rob H
0

Author Comment

ID: 38345783
Rob, your formula does work... one step I didn't think about until I pasted your fix. In that, there are cells in C that have no Timestamp... which if there is no timestamp, then column D should render "" for a no timestamp. What do you recommend?
0

Author Comment

ID: 38345799
Excellent explanation for your formula.
0

Author Comment

ID: 38345825
My objective here is to use "True" to represent the status of equipment that were tagged as non-functional at a specific date/time over 8 hours. If the equipment is functional, there will be no date/time stamp...thereby leaving that field blank and leaving the True/False statement blank.

I will be using the True stamp to then display on a dashboard those non-functional items that need repair. The True statement will provide another filtered list to show equipment with True status along with the equipment number and the date/stamp along with it.
0

Author Comment

ID: 38345912
I'm hoping this is the corrected formula to render "" in column D IF column C is blank:
=IF(C2="","",IF(C2<NOW()-(8/24),"True",""))
0

Author Closing Comment

ID: 38346280
Thank you very much for your assistance. Would you look at my last comment to confirm the last modification to your solution. Thx again!
0

LVL 34

Expert Comment

ID: 38346693
Mod for blank in c2 is fine.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
###### Suggested Courses
Course of the Month18 days, 14 hours left to enroll

#### 834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.