+ Reply to Thread
Results 1 to 2 of 2

Switch ON/OFF with the IF function

  1. #1
    Registered User
    Join Date
    11-27-2020
    Location
    Libreville
    MS-Off Ver
    Office 10
    Posts
    42

    Switch ON/OFF with the IF function

    Hi All,

    Hope you're all doing fine. I am stuck on something that looked simple to me. I have personnel working away on a rotational scheme of 28/28 days. I need to control their stay on site to prevent excessive overstay, and request their travel bookings on time.

    In my spreadsheet, I have Block "A" just to enter personnel names; Block "B" for entry and leave dates; and Block C is an already set-up control Block.

    Now, where I get stuck is to correctly set the formula for ON/OFF switch with an IF function. Basically, once I enter an Entry Date under R column, I get all knock-on effects in columns U,V,W,X (Confirmation of Entry Date, Number of Days on site, Leave date, Return Date).

    That way, if "V" is between 0 and 28, then Column "I" MUST show "ON", and SHOUD keep showing "ON" in case of "Overstay" (If the leave date is not entered into "S" column for confirmation). Note that the Leave Date may be different from the normal scheduled leave date; in this case column "I" should keep showing "ON" if that different leave date is still superior to TODAY (still not passed). But once it is passed, column "I" MUST then switch to "OFF".

    I tried several formulas similar to this one =IF(W5;">"&TODAY();"ON";IF(AND(W5;">"&TODAY();S5;"<>""*");"ON";IF(S5;"<"&TODAY();"OFF";"OFF")) but nothing is working.

    Please help!
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    11-27-2020
    Location
    Libreville
    MS-Off Ver
    Office 10
    Posts
    42

    Re: Switch ON/OFF with the IF function

    Hey Mates,

    I found it. This one works fine: =IF(AND(ISNUMBER(R5);ISBLANK(S5);V5>-1);"ON";IF(AND(ISNUMBER(R5);ISNUMBER(S5);S5>TODAY());"ON";IF(AND(ISNU
    MBER(R5);ISNUMBER(S5);S5<TODAY());"OFF";"OFF"))).

+ 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. Single Button Toggle Switch To Switch Between Columns
    By Zaerick in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-29-2022, 11:55 PM
  2. [SOLVED] why switch() function when I can use If()
    By lastnn30 in forum Excel General
    Replies: 1
    Last Post: 12-04-2021, 10:13 PM
  3. Switch an array within udf function into a range
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-17-2015, 07:49 PM
  4. [SOLVED] Function to switch last and first names leaving out a suffix
    By mattsgirl614 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-07-2014, 01:59 AM
  5. Replies: 0
    Last Post: 04-22-2014, 10:59 AM
  6. how to simulate switch function in excel
    By ACE00 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-16-2009, 04:53 AM
  7. [SOLVED] Switch function
    By [email protected] in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-16-2006, 05:25 PM

Tags for this Thread

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