+ Reply to Thread
Results 1 to 9 of 9

Help to prevent #N/A error in formula

  1. #1
    Registered User
    Join Date
    01-30-2015
    Location
    Washington DC
    MS-Off Ver
    2010
    Posts
    37

    Help to prevent #N/A error in formula

    I got some great help a few days ago to develop a formula that mixed SUMPRODUCT and LOOKUP functions. The formula works great when the referenced areas are all populated, but if a row is blank, I get the #N/A error. I have attached a spreadsheet that has a better explanation.

    Bottom line is that I need the formula to work even when there are blank rows in the model.

    Any help would be appreciated!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,412

    Re: Help to prevent #N/A error in formula

    =IFERROR(your formula,"")

    =IFERROR(SUMPRODUCT(K5:K8*LOOKUP($J$5:$J$8,$B$4:$C$9)),"")

  3. #3
    Registered User
    Join Date
    01-30-2015
    Location
    Washington DC
    MS-Off Ver
    2010
    Posts
    37

    Re: Help to prevent #N/A error in formula

    Thanks but I still need the formula to calculate rows that are populated.

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

    Re: Help to prevent #N/A error in formula

    There might be a simplier formula but off the top of my head, use this ARRAYED formula in K9

    =SUMPRODUCT(K5:K8*IF(ISERROR(LOOKUP($J$5:$J$8,$B$4:$C$9)),0,LOOKUP($J$5:$J$8,$B$4:$C$9)))

    If the empty value is always in the last row(s) then you could use dynamic named ranges and stick with your original formula (except with the named ranges). Is that how it is?
    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

  5. #5
    Registered User
    Join Date
    01-30-2015
    Location
    Washington DC
    MS-Off Ver
    2010
    Posts
    37

    Re: Help to prevent #N/A error in formula

    It's a cost model so deleting data from a row in the middle will definitely happen. So while there will be empty rows at the end as the model grows, there will still be times when the missing data is not at the end. Giving your solution a try now. Fingers crossed.

  6. #6
    Registered User
    Join Date
    01-30-2015
    Location
    Washington DC
    MS-Off Ver
    2010
    Posts
    37

    Re: Help to prevent #N/A error in formula

    That one's making the answer zero all the time...even if I populate all the rows.

  7. #7
    Forum Contributor
    Join Date
    08-07-2015
    Location
    AB, Canada
    MS-Off Ver
    Excel 2013 x64
    Posts
    132

    Re: Help to prevent #N/A error in formula

    The following is an ARRAY formula solution ***************

    =SUMPRODUCT(K5:K8*IFERROR(LOOKUP($J$5:$J$8,$B$4:$C$9),1))

    Copy the formula into cell K9, click in the formula bar at the top (as if you were about to edit the formula), and press Ctl+Shift+Enter

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

    Re: Help to prevent #N/A error in formula

    As an array formula, are you entering it
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.
    Attached Files Attached Files
    Last edited by ChemistB; 08-14-2015 at 10:45 AM.

  9. #9
    Registered User
    Join Date
    01-30-2015
    Location
    Washington DC
    MS-Off Ver
    2010
    Posts
    37

    Re: Help to prevent #N/A error in formula

    You know how you skim past instructions because you think you already know what they say? Yeah, I did that

    It worked!

    I consider myself pretty good at excel but this is the first I've heard of "array formulas". I guess I need to learn about those.

    THANK YOU

+ 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. How to write a formula that will prevent appearance ERROR MESSAGE
    By CLR in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2005, 10:05 AM
  2. [SOLVED] How to write a formula that will prevent appearance ERROR MESSAGE
    By CLR in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 07:05 AM
  3. [SOLVED] How to write a formula that will prevent appearance ERROR MESSAGE
    By CLR in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2005, 06:05 AM
  4. How to write a formula that will prevent appearance ERROR MESSAGE
    By CLR in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 04:05 AM
  5. How to write a formula that will prevent appearance ERROR MESSAGE
    By Huriiii in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  6. [SOLVED] How to write a formula that will prevent appearance ERROR MESSAGE
    By Huriiii in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  7. How to write a formula that will prevent appearance ERROR MESSAGE
    By Huriiii in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM
  8. How to write a formula that will prevent appearance ERROR MESSAGE
    By Huriiii in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-21-2005, 08:05 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