Forum Discussion
How to use COUNTIF only if certain conditions are met
- Aug 16, 2018
Hia,
If I understand the question then I think the attached solves it.
The extra formula is an array so needs to be entered with ctrl+shift+enter.
Hi Douglas
what you are looking for is sumifs and countifs which let you create multiple sets of conditions that need to be matched before anything is added.
so you might have something like sumifs(D1:D3,A1:A3,"x",C1:C3,"Excel") which would add up the numbers in column D where A has an x and C is Excel..
The other, and probably better way to do this is with a pivot table.
I've uploaded a workbook with both solutions for you to have a look at.
(I do hope this isn't your Excel Formulas homework :p )
- Douglas LaingAug 16, 2018Copper Contributor
Thank you Philip. Not homework, but real work. I made it work with the formula. Your pivot table just added all the classes x or not. There is one more item. I thought that I could figure it out with the information you gave me, but no. There is another column - Times taught. I need to multiply that number with the Class length column. Can I do this on the fly or do I need to have a hidden column that does this and pick up the number from that column? I've attached the worksheet with the new column.
- Philip WestAug 16, 2018Iron Contributor
Hia,
If I understand the question then I think the attached solves it.
The extra formula is an array so needs to be entered with ctrl+shift+enter.