Reputation: 13
I'm trying to create a statistics report that gets automatically updated as data is put into a corresponding worksheet. So this being said, there's no telling how much data will be put into the database, so I need to reference entire columns (A:H), instead of closed arrays (A1:H70).
I need the counts, for example, of women who have cancer and live in the city.
Even more, I have a lot of columns, and it happens that sex and whether or no they have cancer will be on totally different sides of the spreadsheet, meaning I have to have a huge array full of data I don't care about, and I'm not sure how to control for that (or if I even need to - maybe I'm just confusing myself somehow?).
To further clarify what I am trying to do, I know that if I were programming this in SAS, I would use Proc Print's Where clause in one easy breezy beautiful line.
Any ideas as to what Excel function I need to use to do this? I've run through a gambit of ideas, trying to use VLOOKUP, ARRAY, MATCH, and a nested IF tree, but all of them ran into dead ends along the way. Thank you for any ideas you might have!
Upvotes: 1
Views: 12813
Reputation: 46371
Sounds like you need COUNTIFS
function, e.g. this formula will count the number of rows that have "x" in column A and "y" in column B
=COUNTIFS(A:A,"x",B:B,"y")
You can add up to 127 criteria using that format, rows are only counted if all criteria are fulfilled
Upvotes: 4