+ Reply to Thread
Results 1 to 3 of 3

Thread: Conditional formatting

  1. #1
    Registered User
    Join Date
    10-28-2011
    Location
    Delhi
    MS-Off Ver
    Excel 2007
    Posts
    86

    Conditional formatting

    Hi

    Attached is the excel file and wish to know:

    a) Total time of the journey (e,g, journey is of more than 12 hours so the total time from 09:20 to 01:20 is 16 hours). Please help with the formula to calculate so.

    b) Formula to make a negative value (already entered) into positive in the next cell.

    c) If train takes more than 16 hours, color red; 12-16 hours, color yellow; <12 hours, color green.


    Thanks
    Sushil
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    USA
    MS-Off Ver
    Excel 2003 - 2007
    Posts
    2,342

    Re: Conditional formatting

    Sushil,

    Attached is a modified version of your example workbook. In cell J5 is the formula that calculates the total journey time, ensuring that journeys are longer than 12 hours as requested:
    =(IF(HOUR(I5)<HOUR(H5),HOUR(I5)+24,HOUR(I5)+12)-HOUR(H5))/24+(MINUTE(I5)-MINUTE(H5))/24/60


    For question b) there was never a need to make negative numbers positive, but if you do need to do that, this formula will make it happen:
    =SQRT(A1^2)


    See attached for how the conditional formatting works. However, with the formula ensuring no journey is less than 12 hours, it doesn't seem possible to have the green condition met...
    Attached Files Attached Files
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    10-16-2011
    Location
    texas
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Conditional formatting

    i think he wants it to be able to realize above 12 hours in the event that it happens, but to also know when its only been 2 hours etc.

    with that said, id suggest swapping to army time if possible (never checked)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0