+ Reply to Thread
Results 1 to 8 of 8

Return blank for empty or NA values

  1. #1
    Registered User
    Join Date
    08-18-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    7

    Return blank for empty or NA values

    Hi Guys

    I have a spreadsheet where I get a mixture of either 0 results (because the field found is empty) or #N/A results (because a match isn't found) from a vlookup.

    I need both of these to just return an empty cell.

    Any ideas how? I've managed one or the other but getting in a muddle over doing both!

    Thanks
    Shell

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    re: Return blank for empty or NA values

    =if(isna(your expression), "", if(your expression = 0, "", your expression))

    It has to evaluate the expression three times ...
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    re: Return blank for empty or NA values

    Hard to say without looking at your formulas. The easiest way is to nest your formula inside an IF Statement
    =IF(ISERROR(MATCH(.....)),"", Yourformula)

    =IF(yourformula = 0, "",yourformula)
    Does that help?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Return blank for empty or NA values

    If we assume the value being returned is text (implied by 0 comment)

    =LOOKUP(REPT("Z",255), CHOOSE({1,2},"", VLOOKUP(A1,B:C,2,0)))

    The VLOOKUP is only performed once in this instance (modify the VLOOKUP of course)

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Return blank for empty or NA values

    I would add the caveat that should the VLOOKUP return a string > 255 chars this approach would not work.
    Last edited by shg; 08-18-2010 at 02:12 PM.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Return blank for empty or NA values

    I've not seen that construct before, and find it very clever.

  7. #7
    Registered User
    Join Date
    08-18-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Return blank for empty or NA values

    Cheers shg, your first post did the trick.

    Thanks
    Shell

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Return blank for empty or NA values

    You're welcome, but I would urge you to use DO's. It's a little more complicated, but much more efficient, especially if the last argument to the lookup is FALSE.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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