?
Solved

calculate hours with excel

Posted on 2013-01-19
3
Medium Priority
?
338 Views
Last Modified: 2013-01-20
Hello

I have the following columns

Run Hours  | Startup Total | Downtime Total |   Operating Hours
24                        2:00                       1:35                    

I am trying to solve operating Hours

The problem is that Run Hours is formatted as a number (i can not change the format as this info comes from other worksheets as data entry)   Startup Total and Downtime Total are formatted as [h]:mm  and these totals come from other worksheets.   To change formating of any of these cells would require extensive rework

The operating hours should be 24 - 2:00 - 1:35 = 21:25 hours formatted as [h]:mm

How do i subtract the hours from the Number and get the right number of hours?
0
Comment
Question by:Inframap
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 19

Expert Comment

by:helpfinder
ID: 38796828
if I do such a formula in excel (24-2:00-1:35) I get result as you want (20:25) - see attached excel sample.
Do you have it somehow else? If so, could you attach your file (or sample where it does not match)?
sample.xlsx
0
 
LVL 14

Accepted Solution

by:
frankhelk earned 2000 total points
ID: 38797071
The example is misleading ...

the number 24 is an integer, and excel internally represents time as a fraction of the day. Therefore any integer number instead of 24 would result in the same result:

24-2:00-1:35 = 20:25
23-2:00-1:35 = 20:25
22-2:00-1:35 = 20:25
and so on.

Unfortunately the 24 represents a full day either, so the first try to simply subtract pretends to work anyhow.

You got to use a little more magic to do the wanted trick - convert the number of hours into ecxel's own representaion (fraction of a day) by dividing it with 24.

OpHours = (RunHours / 24) - Startup - Downtime

Open in new window


See attached example.
RunTimeCalc.xlsx
0
 

Author Closing Comment

by:Inframap
ID: 38799503
great thank you
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

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

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

Join & Ask a Question