+ Reply to Thread
Results 1 to 12 of 12

#N/A Error

  1. #1
    Forum Contributor Nitro2481's Avatar
    Join Date
    09-09-2014
    Location
    Laois, Ireland
    MS-Off Ver
    2013
    Posts
    323

    #N/A Error

    Hi Guy,

    Probably really easy but can you tell me how to use this error in a formula. Eg. I have a list in column B made up of Vlookup's. On occassion the thing I'm looking up is not there so it come back with #N/A. That's fine, if it's not there it's not there but I was hoping that either rather than posting the #N/A I could make it say "" (blank) instead.

    So in Column B I have Vlookup(2,A1:A100,2,False) = "" (if not there) I tried replacing False with ("") eg. Vlookup(2,A1:A100,2,""). This as I'm sure you know did not work

    Alternatively I can work off another column C eg if(B1=#N/A,"",B1)

    Again this didn't work. Any idea's?

    Thanks Matt

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

    Re: #N/A Error

    =iferror(vlookup(2, A1:B100, 2, False), "")
    Entia non sunt multiplicanda sine necessitate

  3. #3
    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
    43,986

    Re: #N/A Error

    Your syntax looks a bit odd. Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? However, please give us an indication of the approximate number of rows of data you want the solution to work with (100, 1000, 100,000 or whatever). Please don't attach a picture of an Excel sheet (no-one will want to re-type all your stuff before starting).

    1. It does NOT have to be your real sheet - mock up a SAMPLE if you need to. But not 1000's of rows!!! It makes manual checking so tedious. Whatever you do... make sure that all confidential information is removed first!!

    2. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    3. Make sure that your desired solution is also shown (mock up the results manually).

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    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

  4. #4
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: #N/A Error

    If you are really using Excel 2003, you can use IF and ISERROR. If you have a newer version (2007+ I believe), you can use IFERROR.

    Try something like this:

    =IF(ISERROR(VLOOKUP(2,A1:A100,2,FALSE)),"",VLOOKUP(2,A1:A100,2,FALSE))

    That being said, the VLOOKUP formula doesn't make sense. You are telling it that you want to look in the second column of a single column range... I would expect it to return a #REF! error.
    Last edited by 63falcondude; 12-11-2018 at 01:18 PM.

  5. #5
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: #N/A Error

    As the OP seems to be using XL2003 shouldn't he use =if(Iserror(vlookup(2, A1:B100, 2, False)), "",vlookup(2, A1:B100, 2, False)) ?

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: #N/A Error

    If the OP just wanted to trap the #N/A error, and report other errors, it would be better to use ISNA. An alternative, to avoid the double VLOOKUP, would be to use COUNTIF.

    Hope this helps.

    Pete

  7. #7
    Forum Contributor Nitro2481's Avatar
    Join Date
    09-09-2014
    Location
    Laois, Ireland
    MS-Off Ver
    2013
    Posts
    323

    Re: #N/A Error

    This returned a #name? error even though there is a number 2 in that range

    Please Login or Register  to view this content.
    In the "set up" sheet I have in column C 123456 In column D I have Apple banana, pear, grape, blackcurrent, Orange
    So the above code should return banana
    Please Login or Register  to view this content.
    This code returns #N/A



    When I put in your code
    =iferror(vlookup(2, A1:B100, 2, False), "") I get #Name

    Matt

  8. #8
    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
    43,986

    Re: #N/A Error

    Please post a sample sheet as requested earlier.

  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,496

    Re: #N/A Error

    You appear to have a couple issues going on. From your post #1
    Vlookup(2,A1:A100,2,False)
    this is telling the vlookup to look for 2 in cells A1:A100 and return what is in column B (that is what the second 2 is for). The problem is that it has to be written TO INCLUDE column B or it will return #N/A. I didn't read through every response so you may have addressed that.
    next (post #7) if you are getting a #name? error for the vlookup in your first part of the post it is not recognizing something in the formula and NOT interpreting it as a vlookup.
    the vlookup with the 7 will return #N/A if 7 is not found in your column C.
    As for the #Name code for the iferror, I believe Pepe answered that for you in post #5. IFERROR isn't recognized in excel 2003, you have to use if(iserror(...
    to repeat what Glenn mentioned in post #3, an attachment (per his description) would go a long way toward getting you the help you need.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  10. #10
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: #N/A Error

    If you are using XL2003, as your profile states, then you won't be able to use the IFERROR function, as that was not introduced until XL2007. You can use this instead:

    =IF(ISERROR(VLOOKUP(2,'Set Up'!$C$1:$D$50,2,FALSE)),"",VLOOKUP(2,'Set Up'!$C$1:$D$50,2,FALSE))

    to trap all errors, or this:

    =IF(ISNA(VLOOKUP(2,'Set Up'!$C$1:$D$50,2,FALSE)),"",VLOOKUP(2,'Set Up'!$C$1:$D$50,2,FALSE))

    to trap only the #N/A error (other errors will be reported), or this:

    =IF(COUNTIF('Set Up'!$C$1:$C$50,2),VLOOKUP(2,'Set Up'!$C$1:$D$50,2,FALSE),"")

    to avoid using VLOOKUP twice - basically, if 2 exists in column C of the Set Up sheet, then perform the VLOOKUP, otherwise return a blank.

    Hope this helps.

    Pete

  11. #11
    Forum Contributor Nitro2481's Avatar
    Join Date
    09-09-2014
    Location
    Laois, Ireland
    MS-Off Ver
    2013
    Posts
    323

    Re: #N/A Error

    =IF(COUNTIF('Set Up'!$C$1:$C$50,2),VLOOKUP(2,'Set Up'!$C$1:$D$50,2,FALSE),"")

    This worked perfect. Thanks a mil for everyone taking the time. Apologies for my initial error. A1:100 should have read A1:B100

  12. #12
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: #N/A Error

    Glad you got it working. Thanks for marking the thread as Solved, and for the rep.

    Pete

+ 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. [SOLVED] Odd Error Handling Behaviour; goes to error handler even when no error?
    By kalikj in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-04-2018, 10:04 AM
  2. [SOLVED] Run-tim error -2147467259(80004005): Automation error Unspecidied error
    By mattress58 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2014, 12:12 PM
  3. Excel macro (compile error. syntax error.) error
    By salar_younis in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-06-2014, 06:11 AM
  4. Receiving following error “Complie error : syntax error” Help
    By masond3 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-02-2012, 10:19 AM
  5. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM
  6. Error 75 File/Path access error, sometimes Error 1004
    By smokebreak in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-16-2011, 02:35 PM
  7. Error Handling - On Error GoTo doesn't trap error successfully
    By David in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-16-2006, 02:10 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