Array match function

tiredofit

Well-known Member
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
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
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
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.
 

Some videos you may like

This Week's Hot Topics

  • Importing multiple excel files into one spreadsheet
    Hi, I'm trying to import multiple excel files (with the same format into a single spreadsheet) so that each day's file is listed underneath the...
  • find many based on a certain criteria
    good evening, I hope someone can help me? I have a workbook sheet 2 contains lots of data.... I would like to be able to find anything on sheet...
  • How to copy multiple rows using If
    Hi all, I'm very new to VBA and have written this simple code to copy certain cells if a certain cell within that row contains any data. I need...
  • VBA If statement
    Dear All, I have two dates, where I'd like a message box to pop, if the dates are between this criteria. [CODE] sDate1 = #10/1/2019#...
  • Text Format
    I have a sheet for user to keyin the data. The format of the data can be 451 / 1903, 0012 / 9908 or 00287 / 0099. The number after the "/" is...
  • Syntax errors
    Good Morning, Trying to compile a workbook, I keep getting a few errors. Here are the first two: [code=rich]Syntax Error: Function...
Top