+ Reply to Thread
Results 1 to 3 of 3

time difference - text cells ?

  1. #1
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    time difference - text cells ?

    Hello everybody,

    I have text cells starting from A1, which are meant to be a time interval for working hours. They are in this format, example: 07:00-19:00 (meaning 12 hours long shift). I want to calculate time difference between cell A1 and B1 (and so on), and highlight cell if time difference between them is smaller than 11 hours. I have this formula, It works fine in the beginning of the row, but makes mistakes when It comes to end of row.

    here It is:

    Please Login or Register  to view this content.

    I'm assuming that happens because formula in last cell calculates from next cell, which is an empty cell.

    I need that for monthly worksheet (hours are within one day), so It would be best If formula somehow stops calculating at the end of last cell. Any suggestions ?

    Sample worksheet attached, my CF formula is allready inserted !

    Thanks for help !

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: time difference - text cells ?

    Maybe...
    =if(A2="","",IF(ISERROR(MOD(LEFT(B1;5)-RIGHT(A1;5);1)*24);0;MOD(LEFT(B1;5)-RIGHT(A1;5);1)*24)<11)

    Adjust the A2 to where the blank at the end would be?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Re: time difference - text cells ?

    Hi FDibbins, how could I adjust A2, not sure what you mean ?

    I forgot to mention that there could be blank cells between time intervals also, not only at the end like in sample worksheet...
    Last edited by Lukael; 03-09-2014 at 06:37 AM.

+ 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. [SOLVED] Time in Time format and text foramt - Finding the Hours difference
    By thilag in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-19-2013, 07:14 AM
  2. VBA userform Time difference in text box
    By Hilton1982 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-23-2012, 04:56 AM
  3. Time difference between two cells using criteria
    By Devi S in forum Excel General
    Replies: 5
    Last Post: 04-17-2012, 07:12 AM
  4. Replies: 3
    Last Post: 03-02-2012, 08:18 PM
  5. Calculate time difference between cells
    By sky in forum Excel General
    Replies: 3
    Last Post: 01-23-2006, 07:15 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