Forum Discussion
Rather Complicated Array Analysis
- Aug 22, 2022
This will do it.
First, we pair down the study group to eliminate blanks:
=DROP(study,-COUNTBLANK(study))
Next, determine which rows have all matches. XMATCH is run against the row where unique values are found so a name appearing twice won't cause a false positive.
=LET(b,BYROW(tests,LAMBDA(row,(IF(COUNT(XMATCH(sg,UNIQUE(row,1)))=ROWS(sg),ROW(row)-11,"")))),FILTER(b,b<>""))
Fold it into a small formula:
=AVERAGE(CHOOSEROWS(means,PickRows))
I am trying to have excel search for names in array C12:C16.
Then, based on those names, search the array G12:J16 (by ROW).
Any rows containing ALL of the names from C12:C16, would then have their corresponding test scores averaged.
Test scores are located in array M12:M16.
In the photo above, we would be looking for the average of 74 and 89, as those are the only two rows (in G12:J16) containing both “Rachel” and “Melissa” (the names found in C12:C16).
I am not sure if this can be done with formulas alone, we may need a helper column or two. I am just learning about the more complicated formulas, such as Index Matching, and Array Formulas, so I’m not sure what they can do with some good layout design.
Hopefully this description helps.
Thank You,
-Kyle P.
This will do it.
First, we pair down the study group to eliminate blanks:
=DROP(study,-COUNTBLANK(study))
Next, determine which rows have all matches. XMATCH is run against the row where unique values are found so a name appearing twice won't cause a false positive.
=LET(b,BYROW(tests,LAMBDA(row,(IF(COUNT(XMATCH(sg,UNIQUE(row,1)))=ROWS(sg),ROW(row)-11,"")))),FILTER(b,b<>""))
Fold it into a small formula:
=AVERAGE(CHOOSEROWS(means,PickRows))
- Kyle_P19Aug 25, 2022Copper Contributor
Patrick2788 I have upgraded to 365, and done the Un-install/re-install process. But the formula still says “#Name” when I add a name to the study group section (C12:C16).
It stays that way no matter what I do, including ctr+z.
- Patrick2788Aug 25, 2022Silver ContributorIf this is a home copy of 365, you might want to go to File | Account in Excel and switch to the Beta Insider channel. A quick update may follow.
- Kyle_P19Aug 25, 2022Copper Contributor
So I signed in and reset again, and it is sort of working now. But as seen in the attached file, it does not compute the average properly after names are added or taken away from the Passed Test cells. The ranges seem good though.
- Kyle_P19Aug 23, 2022Copper ContributorThank You,
That's quite the formula. I'm not even sure how you folded it down, to be honest. It returned the right value until I typed "Bill" into the 3rd cell in the Names section (C14). then the cell would only compute the response #NAME?- Patrick2788Aug 23, 2022Silver ContributorIt sounds like you don't have 365 and access to those functions. When you pressed enter the sheet re-calculated and the formula broke.
- Kyle_P19Aug 23, 2022Copper Contributor
Patrick2788 , that is true, I do not have 365 yet. I didn’t even know it had formula functions the one-time purchase doesn’t.
If I sign up, am I able to copy and paste the formula, and adjust the ranges as needed?
The “fold down” part of re-writing the code is a new concept in excel for me.
Thank You, by the way. If this functionality can work smoothly for me, it’s a game changer.