# Avoid Second lookup - performance issue??

#### kwagner1

##### Active Member
Greetings,

i'm using the following formula to place a "#n/a" in my cell whenever my INDEX result value result in a "0". I am charting and i do not want "0" values to get plotted - so I need to check if the INDEX formula results in a "0" and if it does THEN my result for the cell value is "#N/A" (not plotted on the chart) - other wise I return the number (non-zero).

Is there a better way to do this so I only perform 1 lookup; rather than a second when the result is <> 0?? (something like an "IS" function to check if the result = 0 - but i know that doesnt exist)

=IF(INDEX((\$I\$71:\$I\$80),MATCH(\$C5,\$C\$71:\$C\$80))=0,#N/A,INDEX((\$I\$71:\$I\$80),MATCH(\$C5,\$C\$71:\$C\$80)))

### Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

bump

#### T. Valko

##### Well-known Member
Greetings,

i'm using the following formula to place a "#n/a" in my cell whenever my INDEX result value result in a "0". I am charting and i do not want "0" values to get plotted - so I need to check if the INDEX formula results in a "0" and if it does THEN my result for the cell value is "#N/A" (not plotted on the chart) - other wise I return the number (non-zero).

Is there a better way to do this so I only perform 1 lookup; rather than a second when the result is <> 0?? (something like an "IS" function to check if the result = 0 - but i know that doesnt exist)

=IF(INDEX((\$I\$71:\$I\$80),MATCH(\$C5,\$C\$71:\$C\$80))=0,#N/A,INDEX((\$I\$71:\$I\$80),MATCH(\$C5,\$C\$71:\$C\$80)))
Well, what makes it "complicated" is that you're returning 2 different data types depending on which condition is true.

Maybe put the INDEX formula in one cell then put a simple IF formula in another cell to test for 0.

A1: =INDEX(\$I\$71:\$I\$80,MATCH(\$C5,\$C\$71:\$C\$80))
B1: =IF(A1=0,#N/A,A1)

#### ZVI

##### MrExcel MVP
In Excel 2007+ for numeric I71:I80 try this:
=IFERROR(1/(1/INDEX((\$I\$71:\$I\$80),MATCH(\$C5,\$C\$71:\$C\$80,0))),NA())

#### kwagner1

##### Active Member
thanks.... i will review the suggestions !

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,164,652
Messages
5,838,591
Members
430,557
Latest member
MK15

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back