Array match function

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,825
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
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
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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:
Upvote 0
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:
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,213,504
Messages
6,114,020
Members
448,543
Latest member
MartinLarkin

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top