+ Reply to Thread
Results 1 to 6 of 6

Strange time format [AMOS hours] , need to subtract!

  1. #1
    Registered User
    Join Date
    10-20-2017
    Location
    Dublin, Ireland
    MS-Off Ver
    2202 (Build 14931.20858 Click-to-Run)
    Posts
    50

    Question Strange time format [AMOS hours] , need to subtract!

    1. I've attached file with problem.
    2. In A2 I have output from AMOS Aircraft maintenance system.
    3. It is hours a task is due at.
    4. In this case, the task is due at 56216 hours and 22 minutes.
    5. I want to subtract!
    6. In B2 I have said I'll subtract by 1000 hours.
    7. The result I want is 55216:22.
    8. But the format in A2 will give me an error value!

    Is there a way to amend formatting in A2, to get a working figure?
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,943

    Re: Strange time format [AMOS hours] , need to subtract!

    Use this in C2:

    =VALUE(LEFT(A2,FIND(":",A2)-1))-B2& RIGHT(A2,3)
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    10-20-2017
    Location
    Dublin, Ireland
    MS-Off Ver
    2202 (Build 14931.20858 Click-to-Run)
    Posts
    50

    Re: Strange time format [AMOS hours] , need to subtract!

    Quote Originally Posted by Bernie Deitrick View Post
    Use this in C2:

    =VALUE(LEFT(A2,FIND(":",A2)-1))-B2& RIGHT(A2,3)
    That works perfect Bernie Deitrick, I will break-up formula now, resolve post and add to your reputation with thank for such a prompt response!

  4. #4
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: Strange time format [AMOS hours] , need to subtract!

    So much to go into here...

    Lets keep it short and Simple KISS

    You have TEXT in the fields right now. You should be presenting this as a whole value. Decimal

    How would you do this?

    Glad you asked. The Hours are hours so leave them be but convert the 22 minutes to a decimal of time. Minutes/60, so 22/60 = .367

    Now we have a VALUE not TEXT!

    Take the Value of 55216.367 and place it into A2

    Divide that value by 24, because you want to see it in a worldly view of time HH:MM:SS... only you want Cumulative so [h]:mm:ss and really you just want [h]:mm

    When we divide 55216.367 by 24 we get 2342.35 now we have a real time value in the worldly view of time! so lets format the cell to VISUALLY represent it exactly as you started

    with A2 selected, hit CTRL + 1 OR Right Click on A2 and select Format Cells from the menu (Should be towards the bottom, just read)

    Now Choose CUSTOM

    In the type field put the [h]:mm and hit okay...

    Phew, we are back to where you began... but how do you remove a thousand hours!!!?

    Simple enough, remember that you need to reduce 1k down to a time value so when we subtract from A2 we will need to say A2-(B2/24) and of course format C to have that same custom format for visual aide!


    -----------------

    So what does this look like on your actual file?

    If I had to guess you have a list of values... I would first insert a column next to it and do text to column delimited at your COLON so that it splits hours from minutes
    Then I would say (Hours + (Minutes/60) )/24 and format the resulting column to the format cited above so your back to square one and then add your Results - (Change/24) to get results in a list
    -If you think you are done, Start over - ELeGault

  5. #5
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: Strange time format [AMOS hours] , need to subtract!

    So maybe not KISS like the previous suggestion of parsing and subtracting but if you want values that you can aggregate later you will need to go through this process and understand what is happening and why you could not just do -1k

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Strange time format [AMOS hours] , need to subtract!

    The error is because the value in column A is a text string. In essence, they are numbers (time can be just a number in Excel) stored as text, but Excel seems unwilling to automatically recognize that many elapsed hours.

    How much analysis needs to be done on this? If this is all the analysis, then leaving the inputs as text and the outputs as text (like Bernie Deitrick does) might be just fine. However, if there is additional analysis to perform on these numbers, I would be inclined to permanently convert the inputs to numbers, then any further analysis will be simpler.

    An example of what I might do so that inputs and outputs are numbers rather than text:

    1) Convert column A from text to number of days represented by that elapsed hour:minute text. Maybe in D2 =CONVERT(LEFT(A2,5),"hr","day")+CONVERT(RIGHT(A2,2),"mn","day") [format as elapsed hour such as [h]:mm or similar, if it is necessary to see in elapsed hour format]
    2) Convert column B from hours to days. Maybe in E2 =CONVERT(B2,"hr","day") [again, format as elapsed hours if desired]
    3) Column C is then simply =D2-E2 (formatted as elapsed hours, if desired).

    It all depends on whether you are content to store the inputs and outputs as text or not. If you prefer Bernie's text output, you can ignore mine. But, if there is further analysis, it will almost certainly be easier to convert all values to numbers in order to facilitate the additional analyses.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Add or subtract hours from time
    By Undo in forum Excel General
    Replies: 3
    Last Post: 05-22-2022, 08:53 AM
  2. [SOLVED] How to subtract the total of hours from 'Time In' and 'Time Out' columns...
    By machinegod in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-11-2019, 06:40 PM
  3. subtract 8 working hours from time
    By melody10 in forum Excel General
    Replies: 5
    Last Post: 05-11-2017, 01:02 PM
  4. Subtract time in cells more than 24 hours
    By budakkan in forum Excel General
    Replies: 2
    Last Post: 03-16-2011, 03:11 AM
  5. Replies: 3
    Last Post: 02-22-2011, 01:53 PM
  6. Subtract time between certain days/work hours?
    By lisa b. in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-17-2006, 04:30 PM
  7. [SOLVED] subtract hours, not time of day
    By Steve@Blackhawk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-29-2005, 04:20 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1