+ Reply to Thread
Results 1 to 9 of 9

Adding more variables to my IF formula

  1. #1
    Registered User
    Join Date
    01-07-2021
    Location
    Perth, Australia
    MS-Off Ver
    2016
    Posts
    11

    Adding more variables to my IF formula

    Hello,

    I have the formulae =IF(COUNTBLANK(M2)=0,IF(M2>K2, "Late", "On Time"))

    This is returning the text "Late" or "On Time", if the date in cell M2 is greater than the date in cell K2, only if there is actually a date entered in M2. If there is no date in M2, it leaves the cell with the formulae above as "FALSE". (Ideally I would like to just leave it blank but can't figure that out).

    Now I want to extend the formulae, and say if M2<K2 (LESS THAN), then it returns the value of "Early". I tried to add to the formulae above but it's not picking up the first part of the formula, to say "FALSE" it if there is no value in M2.

    Thank you!
    Kelly
    Last edited by Kellykix; 08-02-2021 at 11:27 PM.

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Adding more variables to my IF formula

    perhaps this will work better for you... =IF(M2="","",IF(M2>K2, "Late", "On Time"))
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Registered User
    Join Date
    01-07-2021
    Location
    Perth, Australia
    MS-Off Ver
    2016
    Posts
    11

    Re: Adding more variables to my IF formula

    Just tried it and it's still returning a value of "On Time" even if cell M2 is blank. Any ideas? Also I'm trying to add "Early" to this formulae somehow. Thanks for any help!

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Adding more variables to my IF formula

    Unless there is something in M2 that you don't see, such as a space, that formula change should return blank.
    Now, if you want early instead of on time then this change should work for you... =IF(M2="","",IF(M2>K2, "Late", "Early"))
    if it doesn't return a blank when M2 is blank then try this in another blank cell to see what it returns... =ISBLANK(M2)
    if that returns TRUE then there is something else wrong and posting a sample workbook (instructions at the top of the page) would help - with expected results even if you hand enter them.

  5. #5
    Registered User
    Join Date
    01-07-2021
    Location
    Perth, Australia
    MS-Off Ver
    2016
    Posts
    11

    Re: Adding more variables to my IF formula

    Ok Yes! =IF(M2="","",IF(M2>K2, "Late", "On Time")) worked after I checked a few things.

    Now the second part: I'm not wanting to change the "On Time" to "Early", but rather I'm wanting to add "Early" as a third option. In this scenario, M2<K2 (rather than MS>K2).

    I'll figure out how to post a sample workbook and post back shortly, thanks so much.

  6. #6
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Adding more variables to my IF formula

    By the way, is there a circumstance where you still want the outcome to be "On Time"? You'll have to explain that so I (we) can see how to fit it into the formula.

  7. #7
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Adding more variables to my IF formula

    The only option I can think of is if M2 is equal to K2 where On Time might be the option.
    So maybe this... =IF(M2="","",IF(M2=K2,"On Time",IF(M2>K2, "Late", "Early")))

  8. #8
    Registered User
    Join Date
    01-07-2021
    Location
    Perth, Australia
    MS-Off Ver
    2016
    Posts
    11

    Re: Adding more variables to my IF formula

    Yes!! This is working beautifully. Perfect, just what I was after. Thank you so much.

  9. #9
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Adding more variables to my IF formula

    Great, glad I could help. Thank for marking the post as solved And thank you for the rep!
    Last edited by Sam Capricci; 08-03-2021 at 07:33 AM.

+ 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: 07-29-2020, 09:51 AM
  2. [SOLVED] adding two time variables to an existing formula
    By chriswrcg in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-03-2019, 08:01 AM
  3. [SOLVED] Adding Different Variables
    By Excel-Access in forum Excel General
    Replies: 2
    Last Post: 03-22-2019, 06:11 PM
  4. [SOLVED] adding extra variables
    By andyrocks256 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-09-2015, 03:49 PM
  5. Help with adding columns with variables
    By NickTank in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-10-2012, 09:51 PM
  6. Adding variables
    By cj21 in forum Excel General
    Replies: 1
    Last Post: 09-29-2011, 06:19 AM
  7. adding value variables to name ranges
    By dagindi in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-01-2010, 06:07 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