Ad
Excel Count Unique Records That Match Criteria In Multiple Rows
In Excel I have a list of members by year and whether they paid or not in each year. I'm trying to determine the number of members who live in NY and have paid in BOTH 2019 and 2021. In the example below, only Mike and Jane meet the criteria. Because the "AND" condition is in the same column, I could not find a similar example. Thank you.
Member | Year | Paid Status | State |
---|---|---|---|
John | 2018 | Paid | NY |
John | 2019 | Paid | NY |
John | 2020 | Paid | NY |
John | 2021 | Not Paid | NY |
Mike | 2018 | Paid | NY |
Mike | 2019 | Paid | NY |
Mike | 2020 | Paid | NY |
Mike | 2021 | Paid | NY |
Mary | 2018 | Paid | CA |
Mary | 2019 | Not Paid | CA |
Mary | 2020 | Paid | CA |
Mary | 2021 | Paid | CA |
Jane | 2018 | Not Paid | NY |
Jane | 2019 | Paid | NY |
Jane | 2020 | Not Paid | NY |
Jane | 2021 | Paid | NY |
Tom | 2018 | Paid | CA |
Tom | 2019 | Paid | CA |
Tom | 2020 | Not Paid | CA |
Tom | 2021 | Paid | CA |
Ad
Answer
With the dynamic formula in Office 365 LET()
and FILTER()
We can return the correct value:
=LET(mem,A2:A21,yr,B2:B21,sts,C2:C21,st,D2:D21,fst,FILTER(mem,(yr=2021)*(sts="paid")*(st="NY")),scnd,FILTER(mem,(yr=2019)*(sts="paid")*(st="NY")),COUNT(MATCH(fst,scnd,0)))
Ad
source: stackoverflow.com
Related Questions
- → Trait 'IlluminateFoundationBusDispatchesJobs' not found
- → Laravel save CSV file error
- → Importing large CSV files in MySQL using Laravel
- → VBA how do I edit cell contents based on contents of two other cells in same row
- → How to work with PHPWord and LaravelExcel in Laravel 5.1 framework?
- → How to generate heading for columns?
- → VBA Excel run javascript form event
- → Reading excel file in Laravel
- → Remove Links on Excel after rendered from table2excel.js
- → Create JSON with through Excel Hierarchy
- → How to download fetch response in react as file
- → Laravel Excel big export. Server error 500
- → Download XLSX file on anchor link click in Laravel 5.2
Ad