+ Reply to Thread
Results 1 to 3 of 3

Formula to add 'Time' formatted cells

  1. #1
    Registered User
    Join Date
    09-10-2014
    Location
    Lexington, KY
    MS-Off Ver
    2021
    Posts
    42

    Formula to add 'Time' formatted cells

    Greetings.
    This might seem like an easy question to most of the users on this site but I'm having a brain freeze.

    I have two cells formatted as 'Category: Time and Type: 1:30 PM'.

    In cell a:1 I enter 10:30 and get a result of 10:30 AM. Good so far.
    In cell a:2 I enter 13:30 and get a result of 1:30 PM. Also what I would expect.

    So, the time that has passed between these two cells is 3 hours. What formula do I use in cell a:3 to calculate the span of time between a:1 and a:2?

    Thank you!

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Formula to add 'Time' formatted cells

    The basic answer is =(A2-A1)*24 and format the cell as GENERAL.

    However, when doing this math, there is always the chance the time span will go past midnight. If that is ever the case, you will need this instead:
    =((A2-A1)+(A1>A2))*24



    Data Range
    A
    B
    C
    1
    10:30 AM
    10:30 PM
    2
    1:30 PM
    1:30 AM
    3
    3
    3
    =((A2-A1)+(A1>A2))*24
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    09-10-2014
    Location
    Lexington, KY
    MS-Off Ver
    2021
    Posts
    42

    Re: Formula to add 'Time' formatted cells

    Thank you so very much Jerry! That was the perfect result that I was seeking.

    Awesome.
    Cheers!

+ 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. IF Statement Help
    By hutchgeo4 in forum Excel General
    Replies: 1
    Last Post: 08-16-2015, 10:48 PM
  2. If statement off cells that are time formatted
    By hutchgeo4 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-12-2015, 02:45 PM
  3. All empty cells in the spreadsheet formatted as time
    By imakosov in forum Excel General
    Replies: 2
    Last Post: 12-10-2014, 09:02 PM
  4. Formula to indicate overlap of time formatted cells?
    By Moonbather in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-01-2013, 03:42 PM
  5. How to totalise time formatted cells
    By olafurbj in forum Excel General
    Replies: 13
    Last Post: 09-16-2011, 12:32 PM
  6. Nested If Statement using Time formatted cells
    By tcowen61 in forum Excel General
    Replies: 5
    Last Post: 09-04-2011, 05:52 AM
  7. Add values to time formatted cells
    By Chutney in forum Excel General
    Replies: 1
    Last Post: 11-30-2009, 07:52 AM

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