+ Reply to Thread
Results 1 to 5 of 5

Using hours and minutes in an If/Then statement

  1. #1
    Forum Contributor
    Join Date
    01-28-2013
    Location
    Spencerport, NY
    MS-Off Ver
    Excel 2016
    Posts
    273

    Using hours and minutes in an If/Then statement

    Hello All
    Another If/then statement question relative to time:

    Pretty simple spreadsheet, I am just having an issue with the if/then statement:

    Trying to help a friend with his vacation calculations and example attached

    Cell B21 he starts with 157 hours and 59 minutes of vacation

    Row 23 reflects vacation time used(if any) during his accrual period.

    Row 26 reflects his 6 hours and 10 minutes of vacation accrual ( which is a constant)

    Row 27 reflects time remaining at end of accrual period

    My struggle is, when writing the if/then statement (see cell c21) is as follows...He cannot carry more than 160 hours of vacation, so in essence he is actually losing vacation if he does not take it, hence the reason for the spreadsheet. Anyways,as you can see, my statement is not reflecting the max of 160 hours in row 21. Any help is greatly appreciated

    Thanks in advance
    Ron
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,309

    Re: Using hours and minutes in an If/Then statement

    You are comparing a time,albeit many hours, to a number. A time is a fraction of a day, for example, 1 hour is 1/24th of a day.

    You need something like:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    ... formatted as general.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    01-28-2013
    Location
    Spencerport, NY
    MS-Off Ver
    Excel 2016
    Posts
    273

    Re: Using hours and minutes in an If/Then statement

    Thank you so much TMS..

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,309

    Re: Using hours and minutes in an If/Then statement

    You're welcome. Thanks for the rep.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Using hours and minutes in an If/Then statement

    FYI, An alternative formula would be

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

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

+ 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. Excel 2007 : Convert number of minutes to hours and minutes
    By MikeFromIndy in forum Excel General
    Replies: 30
    Last Post: 06-05-2015, 08:10 AM
  2. Replies: 13
    Last Post: 05-03-2013, 08:42 PM
  3. RE: Converting decimal minutes to hours, minutes and seconds
    By mills49 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-14-2013, 09:14 AM
  4. Replies: 2
    Last Post: 11-05-2005, 12:25 PM
  5. add hours & minutes to other hours & minutes to receive total hou.
    By Wes in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-01-2005, 08:06 PM

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