1

The following multi-match array function fails against a table with only 1 row. However it works as as soon as there is another row added.

{=MATCH("A"&"C",myTable[Col1]&myTable[Col3],0)}

curly brackets added to show array formula

See picture as example

enter image description here

Is there anyway to force this to work for at times my real data may only have 1 row in the table? (And this also works with only one row of data not explicity formatted as a table).

This modification doesn't work either:

=MATCH("A"&"C",myTable[[#Data],[Col1]]&myTable[[#Data],[Col3]],0)
1

3 Answers 3

2

I do not know why but, you can avoid it by using Aggregate:

=AGGREGATE(15,6,(ROW(Table1[Col1])-MIN(ROW(Table1[Col1]))+1)/((Table1[Col1]="A")*(Table1[Col3]="C")),1)

enter image description here

Sign up to request clarification or add additional context in comments.

8 Comments

Thanks Scott. +1 for providing working solution. My only issue is readability at this point. See my update about the modification I found that does work (and seems a little less messy and understandable than AGGREGATE.
@ScottHoltzman I guess it is a matter of opinion. The Aggregate, when using array formulas, is easier to understand than others. As it has the conditions spelled out.
Fair point. I'll admit I am not 100% comfortable / experienced with it either, so that may skew my viewpoint. For instance, I don't really understand how this part (ROW(Table1[Col1])-MIN(ROW(Table1[Col1]))+1)/((Table1[Col1]="A")*(Table1[Col3]="C")) goes with the SMALL function.
If you have time and a little patience, can you shed some light to lead me in right direction?
@ScottHoltzman It is building an array of row numbers and #DIV/0 errors. The (ROW(Table1[Col1])-MIN(ROW(Table1[Col1]))+1) makes sure that the first row in the table is returning 1, if we were not using tables I would have only done the ROW() as I would use the full column in index so: =INDEX(C:C,AGGREGATE(15,6,ROW(C6)/... so I do not need to do the rest of the math. (continued)
|
2

This modification works, for an alternative to @ScottCraner's answer.

{=MATCH("A"&"C",myTable[[#All],[Col1]]&myTable[[#All],[Col3]],0)-1}

Curly brackets added to designate this needs to be entered as an array formula (by pressing Ctrl+Shift+Enter

Comments

0

If you prefer, it seems you can just wrap your original formula in an iferror:

{=IFERROR(MATCH("A"&"C",myTable[Col1]&myTable[Col3],0),IF("A"&"C"=myTable[Col1]&myTable[Col3],1,0))}

This also gives you the opportunity to build in a return value in the case that you do not have a match in the table at all.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.