Need help on how to create a formula
Need help on how to create a formula
(OP)
Column A has names of people
Column B has months
Column C has week days
I would like to look for certain criteria in all three columns and sum up the totals from column E.
For instance
Ken may be in column A 13 times.
March is in Column B 34 times
Monday shows up in column C 57 times
All three of these are on the same row 6 times. I need a formula to give the sum of all 6 instances where all three fall in the same row.
How would you write that formula?
Column B has months
Column C has week days
I would like to look for certain criteria in all three columns and sum up the totals from column E.
For instance
Ken may be in column A 13 times.
March is in Column B 34 times
Monday shows up in column C 57 times
All three of these are on the same row 6 times. I need a formula to give the sum of all 6 instances where all three fall in the same row.
How would you write that formula?
RE: Need help on how to create a formula
RE: Need help on how to create a formula
Convert your table to Structured Table, assuming every column in your table has unique headers. So list the headers for columns a,b,c&e.
The SUMPRODUCT() function will do nicely, as I can demonstrate with a table with Name, Month, Amt
=SUMPRODUCT((Table1[Name]=A2)*(Table1[Month]=B2)*(Table1[Amt]))
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: Need help on how to create a formula
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: Need help on how to create a formula
I was using the Sumif but for some reason it wasnt reading right. It turned out it was reading a cell it didnt like in one of the columns. I was using full columns "A:A" and I had to give it an actual range "A5:A500". Once I did that, it worked.
Hey Skip
I will look into that. For some reason because I am not real comfortable using tables, I always tend to shy away from them. lol
I need to just start using them to get used to them. Everyone keeps telling me I should. lol
RE: Need help on how to create a formula
It would even be better if the table name was something meaningful, too.
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: Need help on how to create a formula
RE: Need help on how to create a formula
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: Need help on how to create a formula
=SUMPRODUCT((Table1[Name]=H$1)*(Table1[Month]=$F2)*(Table1[DOW]=$G2)*(Table1[Amt]))
And if you were counting occurrences rather than summing and rather than using COUNTIFS()
=SUMPRODUCT(--(Table1[Name]=H$1)*(Table1[Month]=$F2)*(Table1[DOW]=$G2))
NOTICE the similarities and the intuitive nature of each expression within parentheses as compared to having to put operators in QUOTES when using SUMIFS() and COUNTIFS()
Skip,
for a NUance!
RE: Need help on how to create a formula
1) Create a list of all possible names, and name it Names (highlight the list, go to the upper right corner of the sheet to the "name box" and type in the name).
2) Repeat #1 for months and one for days.
3) Pick three cells, and in each one of them use Data Validation to create drop-down lists. Define the source as the name of your list. Now, you have drop down lists to define your search combination.
4) In cell D1, enter the formula =COUNTIF(A1,<Name Drop Down Cell>)+COUNIF(B1,<Month>)+COUNTIF(C1,<Day>)
5) In cell E1, enter the formula =COUNTIF(D1,3)
6) Wherever you want your total, enter the formula =SUM(E:E)
It's not as elegant as Skip's solution, but it's pretty straightforward and easy to do without relying on some of Excel's more "advanced" features.