+ Reply to Thread
Results 1 to 4 of 4

How to add IF to an already IFNA/IFERROR formula

Hybrid View

  1. #1
    Registered User
    Join Date
    11-30-2019
    Location
    Kansas City, Missouri
    MS-Off Ver
    2016
    Posts
    2

    How to add IF to an already IFNA/IFERROR formula

    Hello,
    I am really new to formulas, I've always had someone do them for me, but now I am in charge of several trackers.

    I am working with a formula that brings dates from a different tab via VLOOKUP, and to avoid errors, I used IFNA when my reference is not found: =IFNA(VLOOKUP(C16,'Clean Activity Report (CTMS)'!J:W,14,FALSE),"Pending")

    Now, when my lookup value is found but the col-index-num is empty, I get a 0-Jan-00 result.

    where do I add to my formula (IF =0,"Pending") without affecting the other formula that is currently working well? I've tried several diferent things and nothing seems to work.

  2. #2
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: How to add IF to an already IFNA/IFERROR formula

    =IFERROR(--(VLOOKUP(C16, 'Clean Activity Report (CTMS)'!$J$1:$W$10000,14,FALSE) & ""), "Pending")

    formatted as Date of some form.

    When VLOOKUP returns a bona fide date from column W, the concatenation with the null string ("") converts it to a string; but the double negate converts it back to a numeric date. Note that Excel dates are actually integers, namely: the number of days after 12/31/1899 (0/0/1900). So 1/1/1900 is 1.

    When VLOOKUP returns an empty cell from column W, the concatenation results in the null string; and the double negate of the null string fails with an error (#VALUE).

    Thus, the formula returns "Pending" when VLOOKUP fails to match a row in column J (#N/A) and when VLOOKUP returns an empty cell from column W.

    -----

    Aside.... Please note the change to the range: $J$1:$W$10000 instead of J:W. Change 10000 to the largest number of rows of data that you reasonably believe you will ever have, probably much less than 1+ million rows.

    The whole-column range J:W might cause Excel to search 1+ million rows before failing to find a match. (And there might be other consequences with respect to memory usage, according to some people. I don't know.)

    Also, the absolute cell references ($J$1 instead of J1) allow you to copy the formula into other rows, changing the lookup value C16 accordingly without changing the lookup range.
    Last edited by joeu2004; 11-30-2019 at 02:07 AM.

  3. #3
    Registered User
    Join Date
    11-30-2019
    Location
    Kansas City, Missouri
    MS-Off Ver
    2016
    Posts
    2

    Re: How to add IF to an already IFNA/IFERROR formula

    Hello joeu2004, this did the trick, and gave me a great lesson. I will look for some deeper guidance as I have never seen the "--" in a formula and I have never used "&". Thank you!
    Last edited by davesexcel; 11-30-2019 at 03:03 AM.

  4. #4
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: How to add IF to an already IFNA/IFERROR formula

    Quote Originally Posted by renzwill View Post
    I will look for some deeper guidance as I have never seen the "--" in a formula and I have never used "&". Thank you!
    You're welcome.

    You will find a lot of misinformation about "--". Some people call it "double unary minus", as if it is __an__ operator. It is simple two unary minuses in sequence.

    And some people think you "must" use double negation to convert numeric text (and logic values TRUE and FALSE) to numeric values. So they write silly things like --(A1:Z1=B2)*A3:Z3. In that context, the double negation is redundant.

    Any arithmetic operation will covert numeric text and logic values to numeric values. Use "--" to preserve the sign. In your context, some people prefer 1*VLOOKUP(...) or 0+VLOOKUP. They accomplish the same thing.

    "&" is the string concatenate operator. Use it instead of the needless CONCATENATE function.

    However, if you have Office 365 or a later version of Excel, look at the CONCAT function. Although it is not necessary for your immediate question, it provides a valuable feature that you might use in the future: the ability to specify an array or range of cells with strings to concatenate.

+ 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. Mixing an IFNA, a vlookup & an 'AND'?
    By Weaselwithagun in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-25-2019, 11:48 AM
  2. IFNA comparison and add infromation
    By Marvindehaas in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-20-2019, 02:40 AM
  3. IFNA Formula
    By prudential in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-03-2018, 01:39 PM
  4. IFNA formula not working
    By bbeards in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 03-01-2018, 02:31 PM
  5. [SOLVED] Using IFNA in an IF Formula
    By Rocksteady in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-05-2017, 12:04 PM
  6. How to mix an IFNA with a IFVLOOKUP
    By Weaselwithagun in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 12-14-2016, 07:38 AM
  7. [SOLVED] Difficulty figuring out were to put IFNA
    By TheBakerBoy in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 02-25-2016, 03:00 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