+ Reply to Thread
Results 1 to 8 of 8

Time and IF statement problems

  1. #1
    Registered User
    Join Date
    07-15-2012
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    55

    Time and IF statement problems

    What i am trying to achieve is determine whether it is Morning, Afternoon or Evening

    In C3 i have a date and a time (with General format) in L3 i have the following formula to strip out the time only (=RIGHT(C3,7))



    Thanks in advance for any help!

  2. #2
    Registered User
    Join Date
    07-15-2012
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    55

    Re: Time and IF statement problems

    In F3 i have the follwoing formula =IF(L3<TIM*(14,0,0),"Morning",IF(L3>=TIME(18,0,0),"Evening","Afternoon")) for some reason all im getting is Eve.

  3. #3
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Time and IF statement problems

    One option:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by Olly; 09-20-2019 at 05:47 AM.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  4. #4
    Registered User
    Join Date
    07-15-2012
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    55

    Re: Time and IF statement problems

    Thanks very much!

    so i didn't need to spilt the time out into L3?

  5. #5
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Time and IF statement problems

    or you get the time by =RIGHT(C3,7) becoming mod(C3,1)

    then

    =LOOKUP(l3,{0,14,18},{"Morning","Afternoon","Evening"})

  6. #6
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Time and IF statement problems

    No you could get it from the datetime function, although if you needed to the mod function retains it as a time, rather than text

  7. #7
    Registered User
    Join Date
    07-15-2012
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    55

    Re: Time and IF statement problems

    Thanks very much

  8. #8
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Time and IF statement problems

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. You may also 'Add Reputation' to those who helped you. Thanks.

+ 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. Problems using If-statement
    By hahaha1241 in forum Excel General
    Replies: 1
    Last Post: 05-01-2015, 09:38 AM
  2. [SOLVED] If then statement problems
    By LostGuy80 in forum Excel General
    Replies: 15
    Last Post: 11-18-2014, 12:39 AM
  3. Replies: 2
    Last Post: 07-22-2014, 09:20 AM
  4. If Then Statement Problems
    By Snurry in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-18-2009, 05:20 AM
  5. if statement problems
    By nighttrain112 in forum Excel General
    Replies: 2
    Last Post: 01-21-2008, 08:32 AM
  6. Problems with IF statement
    By terry_d in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-05-2006, 01:50 PM
  7. Problems with an IF statement
    By Amaloney in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-15-2005, 12:52 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