View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bernard Liengme Bernard Liengme is offline
external usenet poster
 
Posts: 4,393
Default Index returning #N/A

On Sheet2 I have this
****** Jan Feb Mar
alice 83 22 57
fred 137 125 193
george 132 112 33


The names are in A1:A8; the months in B1:M1; numbers in B1:M8

On Sheet1 in A1 I have a name (say Fred) , in B1 a month (say Mar)
In C1 this formula
=INDEX(Sheet2!$B$2:$M$4,MATCH(A1,Sheet2!$A$2:$A$8, 0),MATCH(B1,Sheet2!$B$1:$M$1,0))
returns the intersection of the month and name (here it is 33)

If I now modify this to
=IF(ISERROR(the_Index_formula),"",the_Index-fromula)
I believe we get what you want
Here it is
=IF(ISERROR(INDEX(Sheet2!$B$2:$M$8,MATCH(A1,Sheet2 !$A$2:$A$8,0),MATCH(B1,Sheet2!$B$1:$M$1,0))),"",IN DEX(Sheet2!$B$2:$M$8,MATCH(A1,Sheet2!$A$2:$A$8,0), MATCH(B1,Sheet2!$B$1:$M$1,0)))

Of course, the use of named ranges makes this a easier on the eyes
=IF(ISERROR(INDEX(mydata,MATCH(A2,mynames,0),MATCH (B2,mymonths,0))),"",INDEX(mydata,MATCH(A2,mynames ,0),MATCH(B2,mymonths,0)))
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Jon Dow" wrote in message
...
I have this very long (probably can be shortened but it is the only way I
know to do it) formula that look and matches 2 criteria. Here is the
formula:

{=IF(INDEX(ST!$G$7:$G$1478,MATCH($A6&$G$2,ST!$E$7: $E$1478&ST!$D$7:$D$1478,0))<=1,"",INDEX(ST!$G$7:$G $1478,MATCH($A6&$G$2,ST!$E$7:$E$1478&ST!$D$7:$D$14 78,0)))}

In a quick nutshell ST! is the name of the sheet. A6 is the name I am
looking up and G2 is the month that it is matching.

What I want it to do is to lookup the name and month to pull out the sales
figure. If it does not find it, I want the result to be 0 or the word Zero
instead of the #N/A that comes up. Or leave it blank by the "". The #N/A
mess
up all my totals on the sheet.

Is there an easy (easier) formula to make this happen?