+ Reply to Thread
Results 1 to 5 of 5

IF statement repeated multiple times

  1. #1
    Registered User
    Join Date
    11-12-2018
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    3

    IF statement repeated multiple times

    Hi,

    Can someone please help me.

    I have a Cell with a drop down list with the 24 hour clock in 5 min periods (example 06:00, 06:05, 06:10 - on so on)

    now I need a cell that can read between two values to return TEXT back, but for 3 separate IF statements.

    so basically, if the time is between X,Y = Day shift. if the time is between A,B = Evening Shift. If the time is between C,D = Night Sh

    IF(K1>=06:30,<=14:29)"Day Shift","" + IF(K1>=15:00,<=22:59),"Evening Shift","" + 'IF(K1>=23:00,<=06:29),"Night Shift",""

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Need Help: IF statement repeated multiple times

    Try this:

    =IF(AND(K1>=TIME(6,30,),K1<=TIME(14,59,)),"Day Shift",IF(AND(K1>=TIME(15,0,),K1<=TIME(22,59,)),"Evening Shift",IF(OR(K1>=TIME(23,0,),K1<=TIME(6,29,)),"Night Shift","")))
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    11-12-2018
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    3

    Re: Need Help: IF statement repeated multiple times

    Quote Originally Posted by Glenn Kennedy View Post
    Try this:

    =IF(AND(K1>=TIME(6,30,),K1<=TIME(14,59,)),"Day Shift",IF(AND(K1>=TIME(15,0,),K1<=TIME(22,59,)),"Evening Shift",IF(OR(K1>=TIME(23,0,),K1<=TIME(6,29,)),"Night Shift","")))
    That worked, Thank you very much Glen.

  4. #4
    Registered User
    Join Date
    11-12-2018
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    3

    Re: Need Help: IF statement repeated multiple times

    Hi Glen,

    is it possible to add a (ISBLANK) before this formula? - if K1 is empty, it is populating the cell with "Night" in which I want the cell to be empty. I tried along the lines of:

    =IF(ISBLANK(K1),"",IF(AND(K1>=TIME(6,30,),K1<=TIME(14,59,)),"Day Shift",IF(AND(K1>=TIME(15,0,),K1<=TIME(22,59,)),"Evening Shift",IF(OR(K1>=TIME(23,0,),K1<=TIME(6,29,)),"Night Shift","")))

    but it won't accept it. Can you help please.


    EDIT: never mind, i have got it working.
    Last edited by AdamThompson569; 11-14-2018 at 11:02 AM. Reason: Solved

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: IF statement repeated multiple times

    =If(K1="","",formula) is the standard way of doing that... just in case you are doing something more cumbersome...

+ 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: 1
    Last Post: 05-23-2018, 04:55 AM
  2. No of times names to be repeated
    By goodboy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-02-2016, 10:14 AM
  3. Identify accounts repeated more than 3 times
    By Pbb1008 in forum Excel - New Users/Basics
    Replies: 6
    Last Post: 06-20-2016, 11:15 PM
  4. [SOLVED] Number of times same text is repeated
    By fedfed in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-09-2014, 07:43 AM
  5. vba for Autofilter if the name on a column repeated >=20 times
    By anto_01 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-14-2012, 04:45 PM
  6. Replies: 12
    Last Post: 08-10-2012, 05:11 PM
  7. Count No. of times Dates are repeated
    By Mandeep Dhami in forum Excel General
    Replies: 6
    Last Post: 12-07-2005, 11:00 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