+ Reply to Thread
Results 1 to 16 of 16

If formula with Time

  1. #1
    Registered User
    Join Date
    09-03-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    41

    If formula with Time

    Hi Guys,

    Need your help with an 'if' formula with TIME.

    If clock-in time is between 9.00pm and 11:59pm (cell A1), and clock-out time is higher than 12:00am (cell B1), then update the time to 12:00am (cell c1), or leave it as it is. Thanks!

    you help is highly appreciated.

    Thanks

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: If formula with Time

    Try the attached file!

    Just be careful with Time Formats.

    Hope it helps!

    Deep
    Attached Files Attached Files
    Cheers!
    Deep Dave

  3. #3
    Registered User
    Join Date
    09-03-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    41

    Re: If formula with Time

    Hi mxexcelathome,

    Your formula, works like magic. Thanks a lot.
    However, how did you define 0.875 = 21:00? Should I wish to change that to 22:00, how do i do that. Appreciate your help on this. Thanks!

  4. #4
    Registered User
    Join Date
    09-03-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    41

    Re: If formula with Time

    I've worked it out.. Thanks though

  5. #5
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: If formula with Time

    Glad it helped!

    Deep

  6. #6
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: If formula with Time

    Quote Originally Posted by rubz71 View Post
    If clock-in time is between 9.00pm and 11:59pm (cell A1), and clock-out time is higher than 12:00am (cell B1), then update the time to 12:00am (cell c1), or leave it as it is.
    The condition for B1 has confused me! Any hour must be greater than 12:00 AM. Maybe it is unuseful.
    Quang PT

  7. #7
    Registered User
    Join Date
    09-03-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    41

    Re: If formula with Time

    Hi Deep,

    Just realise B1 Cell value is unaccounted for on your solution you provided.

    If clock-in time is between 9.00pm and 11:59pm (cell A1), and clock-out time is higher than 12:00am (cell B1), then update the time to 12:00am (cell c1), or leave it as it is.

    How can we incorporate B1 cell value within the formula?

  8. #8
    Registered User
    Join Date
    09-03-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    41

    Re: If formula with Time

    Just realised it. Any idea how we can incorporate B1 in the formula?

  9. #9
    Valued Forum Contributor
    Join Date
    12-25-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    506

    Re: If formula with Time

    Quote Originally Posted by rubz71 View Post
    If clock-in time is between 9.00pm and 11:59pm (cell A1), and clock-out time is higher than 12:00am (cell B1), then update the time to 12:00am (cell c1), or leave it as it is.
    Is there already an existing value in cell C1?
    If not, what do you mean by "leave it as it is"?


    _______________________________________________________________________________________________________________________________
    1. Click on the * Add Reputation if you think someone helped you
    2. Mark your thread as SOLVED when question is resolved

    Alvin

  10. #10
    Registered User
    Join Date
    09-03-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    41

    Re: If formula with Time

    C1 is blank. Leave it as it is means show the current value of A1; should the criteria (value of A1 and B1) doesn't meet.

  11. #11
    Registered User
    Join Date
    09-03-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    41

    Re: If formula with Time

    if the value of A1 is in between 9pm and 1159pm and value of B1 is higher than 12 am, c1 should show midnight (12am), or the original value of A1.

  12. #12
    Valued Forum Contributor
    Join Date
    12-25-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    506

    Re: If formula with Time

    Hi rubz71, is this what you're looking for?
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    _______________________________________________________________________________________________________________________________
    1. Click on the * Add Reputation if you think someone helped you
    2. Mark your thread as SOLVED when question is resolved

    Alvin

  13. #13
    Registered User
    Join Date
    09-03-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    41

    Re: If formula with Time

    Hi Alvin,

    That is correct. However, the formula is not picking up B1 Value.

    A1=21:30pm, B1 =23:50pm and your formula returning midnight 00:00. However, it should have returned 21:30 as B1 value is less than 00:00

  14. #14
    Valued Forum Contributor
    Join Date
    12-25-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    506

    Re: If formula with Time

    Hi rubz71,

    On second thought, your criteria for B1 doesn't make sense for me as any normal time value definitely higher than 12:00 AM.

    Unless, your cells in A1 and B1 are in date/time format (i.e. not only time) in which your criteria will be something like "if the value of A1 is in between today 9pm and today 1159pm and value of B1 is higher than today 12 am, c1 should show today midnight (12am), or the original value of A1"?


    _______________________________________________________________________________________________________________________________
    1. Click on the * Add Reputation if you think someone helped you
    2. Mark your thread as SOLVED when question is resolved

    Alvin

  15. #15
    Registered User
    Join Date
    09-03-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    41

    Re: If formula with Time

    Hi Alvin,

    I understand. That make sense. However, should the formula read A1 value higher than 9pm and B1 value less than 11:59pm, display 00:00, or else display A1. Can this be doable?

  16. #16
    Valued Forum Contributor
    Join Date
    12-25-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    506

    Re: If formula with Time

    Hi rubz71,

    It's doable, but the result will only display A1 if A1 <= 9pm and B1 >= 11:59pm (i.e. 11:59:00pm to 11:59:59pm).
    Are you sure this is what you're looking for?


    _______________________________________________________________________________________________________________________________
    1. Click on the * Add Reputation if you think someone helped you
    2. Mark your thread as SOLVED when question is resolved

    Alvin

+ 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. Replies: 3
    Last Post: 12-19-2013, 06:49 AM
  2. Replies: 5
    Last Post: 04-18-2013, 11:31 AM
  3. Formatting a total time entry and building a cumulative time formula.
    By TMc10 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-16-2012, 10:26 PM
  4. Formula for Calculating Paid Time Off for fiscal anniversary date real time
    By 168rockwood in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-07-2012, 04:15 PM
  5. Replies: 2
    Last Post: 04-27-2011, 08:21 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