# Combining the IF-and MATCH-functions

How do I do this: `(IF(MATCH(x; array)<>error*; if-true; else)`

• means that the Match function did not find a match and concrete: you get a “#N/A”

IFNA(MATCH(…);“No Match”)

Of course - Good to have you, Villeroy
EDIT - But are you sure?
Cause Using IFNA I get a TRUE - not the value from the argument in my IF-function

The way I have solve this now is combining =IFERROR IF and MATCH

t71031.ods (12.1 KB) Works for me. Returns “No Match” for even numbers, the matched index for odd numbers.

The test for errors returns True for any error in formula syntax, formula semantic or any error in a reference.
The test for n/a is more selective. It indicates that your formula is syntactically and semantically correct but that there is simply no matching value in the search vector. If there is an error in the referenced cells, you get this error anyway. IMHO, it is a mistake to hide away all kinds of errors.

Yes but I need a function that return another value than the one which “MATCH” returns - when it find match
So your IFNA solution is only working halfway (when there is no Match)

So as wrote elsewhere:

I GOT at solution (it is “=IFERROR(IF((MATCH…”
So let me put it in another way of saying it: I want to get rid of the "IFERROR-function
OR
I need to know how to tell the “IF-funktion” what to do in that case when MATCH-function return a “#N/A” (cause all I have to know is if there is a match - The value of the MATCH function I don’ t care about )

There is also ISNA(MATCH(…)) or the opposite: ISNUMBER(MATCH(…)). MATCH returns either #N/A or a number, never text.

Yes the ISNA and ISNUMBER can replace the ISERROR
What I want, was more clarity - so I could skip the combination with ISNA/ISNUMBER/ISERROR with my IF-function
The only way I can see that can happening, is - if you could do `" `IF(MATCH(x; array)=#N/A;…`

In this case, you don’t need `MATCH()` or `ISND()` - It is quite enough
`=IF(COUNTIF(array; x); if-true; else)`

If `x` occurs at least once in the `array`, then the result of `SUMIF()` will be nonzero, for IF() this is enough to perform `if-true`.

Thanks - I will try that - I did not knew COUNTIF

IF(ISNA(MATCH(…
or IF(ISERROR(MATCH(…
or IFERROR(MATCH(…

What mean `if-true`? Result of MATCH(…)? In this case last function for you

IF the function with its condition: "match() should not be equal with “#N/A” - is true

EDIT Maybe I should try `IF(MATCH(x; array)= error*; if-true; else)`
But anyhow I need to know how to tell the IF-funktion what to do- when MATCH return a “#N/A”

Thanks, I know what should be in the second parameter of the IF() function. I asked what would be in your formula.

In this case try `=IF(ISNUMBER(MATCH(...));...;...)`

I GOT at solution (it is “=IFERROR(IF((MATCH…”
So let me put it in another way of saying it: I want to get rid of the "IFERROR-function
OR
I need to know how to tell the “IF-funktion” what to do in that case when MATCH-function return a “#N/A” (cause all I have to know is if there is a match - The value of the MATCH function I don’ t care about )