Modifying formula to include more options

Skrej

Board Regular
Joined
May 31, 2013
Messages
176
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have the following formula (previously provided via another thread) which cumulative lists instances of a code for a given number of sheets.
Excel Formula:
=LET(d,VSTACK('Aug:Oct'!C8:V32),n,INDEX(d,,1),u,UNIQUE(FILTER(n,n<>"")),HSTACK(u,BYROW(u,LAMBDA(br,SUMPRODUCT((INDEX(d,,1)=br)*(d="t15"))))))

It works fine, and I understand how to modify it for given sheets. What I'd like to do is have it search for multiple codes (e.g. not just 't15' in the formula above, but also 't30, t45, t60 as well as 'e15', 'e30','e45' and 'e60'.

Is there I way I can set the value of d in the code above to include multiple options? I've tried adding the other codes separated by commas, but that throws an error.


(d="t15","t30)
(d="t15", d="t30")

Not sure if I'm just missing some syntax, or if I need to nest multiple index statement for each code, or what.

To further clarify, each month's sheet has a list of names down the leftmost column, followed by a code for each day (1 day per subsequent column to the right of the names). Other codes are used, but I don't need to tally them.

My main problem is I don't understand the formula well enough to interpret it.
 
That seems to work although for some reason it adds quite a bit of unwanted space above the list of names.
data6.png
 
Upvote 0

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
I'm embarrassed to say the spacing was just a row width that I was unaware was enlarged. Thank you for all your help.

If possible, I'd like to exclude instances of zero (if the value is zero, don't show the name), but I can live with this. Again, thanks for the help.
 
Upvote 0
Hello again, thanks for your patience! Do you mean this:

Excel Formula:
=LET(
d,VSTACK(Aug!C8:V32),
n,INDEX(d,,1),
u,UNIQUE(FILTER(n,n<>"")),
a,HSTACK(u,BYROW(u,LAMBDA(br,SUMPRODUCT((INDEX(d,,1)=br)*(ISNUMBER(--(RIGHT(d)))))))),
FILTER(a,CHOOSECOLS(a,2)<>0))
 
Upvote 0
Solution
Yes, that works well. Thank you very much! Due to space on the sheet (which we print out) and the potential number of students, it's preferable not including names with zero tallies.

I really appreciate all your time and effort. Once I've finished and shared the master version, around a dozen people will ultimately benefit from your contribution.
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top