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,734
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,734
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,499
Messages
5,340,740
Members
399,393
Latest member
farlow

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top