+ Reply to Thread
Results 1 to 5 of 5

Calculate dates/times using If Statements?

  1. #1
    Registered User
    Join Date
    09-02-2008
    Location
    Scotland
    Posts
    2

    Calculate dates/times using If Statements?

    I'm not too hot with Excel formulas but I'll explain as best I can....hopefully someone can help

    I have 3 columns with dates and times

    A - 01/08/2008 08:17:08
    B - 01/08/2008 12:17:08
    C - 01/08/2008 17:00:11

    This is what I want to do...

    If A > B then Calculate the time difference between A and C
    If A <= B then Calculate time difference from B to C

    I'd like to get this formula in 1 cell if possible?

    Thanks in advance. Roper99
    Last edited by oldchippy; 11-09-2008 at 11:48 AM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Welcome to the forum.

    Maybe =IF(A1 > B1, ABS(A1-B1), ABS(B1-C1)) and format the result as [h]:mm
    Last edited by shg; 09-02-2008 at 10:43 AM.

  3. #3
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi,

    Try this

    =IF(A1>B1,C1-A1,IF(A1<=B1,C1-B1,"")) and format the result as [h]:mm
    Last edited by oldchippy; 09-02-2008 at 10:45 AM. Reason: format cell
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  4. #4
    Valued Forum Contributor
    Join Date
    08-26-2008
    Location
    singapore
    Posts
    626
    A small modification for shg

    =IF(A1 > B1, ABS(A1-C1), ABS(B1-C1))

  5. #5
    Registered User
    Join Date
    09-02-2008
    Location
    Scotland
    Posts
    2
    Thanks for the quick response. It's working now

+ 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. Auto Calculate-.Is this possible to have a macro?
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-24-2010, 07:16 AM
  2. Calculate Total Time when Dates/Times Overlap
    By Steve Gilley in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-18-2008, 07:43 PM
  3. Too many IF statements
    By shane24 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-01-2007, 07:52 PM
  4. File fails to calculate - corrupted?
    By bahguy in forum Excel General
    Replies: 3
    Last Post: 08-09-2007, 03:53 AM

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