Array match function

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,080
I have the values a,b,c in cells A1 through to A3.

I have the value a in cell C1.

In cell C4, I type:

Code:
=MATCH(1,(C1=A1:A3))
and enter it as an array function.

I get the result of #N/A.

Why is that?

I thought the logic is as follows:

It compares the value in cell C1 (ie a) with the values in cells A1 to A3 and returns an array of TRUE, FALSE, FALSE.

These in turn are converted to 1,0,0.

Finally the result should be 1?

Thanks
 

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
7,724
Office Version
365
Platform
Windows
You do create that array but you have nothing there that does any converting of the array to numbers and you need to use match type false or 0 as yours will default to true or 1. So maybe:

=MATCH(1,--(C1=A1:A3),0)

This needs CTRL-SHIFT-ENTER.

Or as you are doing an equals just use:

=MATCH(C1,A1:A3,0)
 
Last edited:

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,080
You do create that array but you have nothing there that does any converting of the array to numbers and you need to use match type false or 0 as yours will default to true or 1. So maybe:

=MATCH(1,--(C1=A1:A3),0)

This needs CTRL-SHIFT-ENTER.

Or as you are doing an equals just use:

=MATCH(C1,A1:A3,0)
Thanks for your reply.

I don't understand the need for the -- because I am trying to follow this:

Rich (BB code):
https://exceljet.net/formula/index-and-match-with-multiple-criteria



and that article doesn't add the --.

Besides, it doesn't explain the significance of the 1 immediately after the MATCH, ie:

Rich (BB code):
MATCH(1,{0;0;1;0;0;0;0})
it states:

Rich (BB code):
which is fed into the MATCH function as the lookup array, with a lookup value of 1:



 
Last edited:

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
7,724
Office Version
365
Platform
Windows
You could just use =MATCH(TRUE, etc etc. Because you used =MATCH(1 then you need to convert a true/ false array into numbers. To do that you need to understand that to excel 0 = False and 1 = True. If you type :

=TRUE

into a cell, then type

=--TRUE

You may then see the significance of the -- when trying to match 1.
 

Forum statistics

Threads
1,078,273
Messages
5,339,190
Members
399,288
Latest member
ossa

Some videos you may like

This Week's Hot Topics

Top