1

I think Excels FILTER function is great, especially when combined with SORT, CHOOSECOLS and so on.

What I did not even manage to google, let alone find a solution for is: can I "paste" a calculated columns to the results of FILTER function.

For example:

enter image description here

I have the original data on the left, I want to FILTER the rows where a person had passed a test and then for example COUNT how many times have they passed a test.

It is just an example, it can be how many exams have they took in the first trimester, analogously it could be the total amount billed if you look at customer invoices and so on.

The column with the yellow title is the column that I want "pasted", i.e. calculated.

I could do FILTER and then add formulas in the last column as I did here. But it does not adapt to number of rows being filtered, as below (if Carol passed one test less for example).

enter image description here

How to do it or is it for some reason better to do it fundamentally in another way?

1 Answer 1

1

If you have Excel 365 current channel you can use this formula:

=LET(d,A24:D35,
f,FILTER(d,INDEX(d,,4)=TRUE),
sPassed,CHOOSECOLS(f,1),
cnt,MAP(sPassed,LAMBDA(s,ROWS(FILTER(sPassed,sPassed=s)))),
HSTACK(f,cnt))

As COUNTIF doesn't work within MAP, you have to use the FILTER function together with ROWS to count how often a student has passed. .

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

1 Comment

Thanks. I will need some time to digest this but I get the idea.

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.