Using the result of a Filter formula to identify cells in a table?

unclefish

New Member
Joined
Jun 8, 2023
Messages
11
Office Version
  1. 2019
Platform
  1. Windows
Dear Excelists,

I'd appreciate your comments regarding the following problem.
  • I have two separate tables: the first table listing patients (Patient #), the region where they received a treatment (Region) and the treatment option (Treatment). The second table summarizes the patients (Patient #), the treatment they received (Treatment) and the gender of the patients (Gender).
    Please note that patients may have received multiple treatments or may have been treated in multiple regions. The tables have different lenghts, because the first table includes the information on the treated region, while the second doesn't.
  • I would like to use the data of the two tables in such a way that I get the number of female and male patients for a combination of region and treatment option.
I created an example of my problem. The real tables include data of hundreds of patients, which is why i can't (don't want to) do this manually.

1715855402219.png


In this example, i'm interested in patients that were treated in Region1 and that received treatment Option1. I entered this information into the cells C13 and C14, respectively.

I know how to identify the patients treated in Region1 and with treatment option Option1 by filtering the first (green) table with the following formula:
Rich (BB code):
=FILTER(B2:B10,(C2:C10=C13)*(D2:D10=C14))
The matching patients are (in this example) listed in the cells C16:C17. In practice, the number of patients and the lenght of this list may vary, depending on the querried region and treatment option.

But now i'm stuck :(.
How can is use the results of this formula to filter the second (blue) table and identify the number of female / male patients?

Any help would be highly appreciated!
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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