How to do COUNTIFS in horizontal and vertical data with unequal number of rows? - excel

How can I count the number of occurrences of numbers 3, 4, 5, etc. of data that meets the criteria in both horizontal and vertical positions using Excel functions?
A B C D
Trainer Q1 Q2 Q3
Terry Wong 5 4 4
Terry Wong 4 4 4
Terry Wong 4 4 2
Terry Wong 3 3 2
Maggie Ngeow Nyuk Chin 3 4 4
Maggie Ngeow Nyuk Chin 4 4 4
Maggie Ngeow Nyuk Chin 4 4 4
I have tried
=COUNTIFS(A1:A8,"=Terry Wong",B:D,"=4")
But there is an error in it because Excel needs both range criteria to have an equal number of rows.
Can you suggest a workaround for this?

Just in case it's useful to anyone, here's a formula that will return the total number of 4's for Terry Wong:
=SUMPRODUCT(--(A2:A8="Terry Wong"),(B2:B8=4)+(C2:C8=4)+(D2:D8=4))

Do you mean you want to do this:
=COUNTIFS(A2:A8,"Terry Wong",C1:C7,4,D1:D7,4,E1:E7,4)

Related

How to multiply each row and then sum it with the product in the next row etc

I am trying to calculate total for each month based on Score and Number of occuruencies each month:
Category# Score Jan-18 Feb-18 Mar-18 Apr-18
category1 10 1 5 1 5
category2 8 2 4 2 4
category3 7 3 3 3 3
category4 6 4 0 4 0
category5 5 0 1 0 1
TOTAL 71 108 71 108
In the essence, for January I could type the following formula:
=($B$2*C2)+($B$3*C3)+($B$4*C4)+($B$5*C5)+($B$6*C6)
But it is very clumsy, so I am wondering if I could something more elegant and clean
that is what SUMPRODUCT is for
=SUMPRODUCT($B$2:$B$6,C2:C6)
Use SUMPRODUCT. It's exactly what you need:
SUMPRODUCT function
I replied your data:
The formula I have used is:
=SUMPRODUCT($B$4:$B$8;C4:C8)
After applying to first column (Jan-18), just drag it to the right, and it should return the right values, as you can see in the image.
Hope this helps!

Formula to transpose horizontal numeric data vertical in excel

My input data in column A
1
2
3
4
5
6
7
8
9
If I want the above in Column B C D like
1 2 3
4 5 6
7 8 9
Use INDEX with some math:
=INDEX($A:$A,(ROW($A1)-1)*3+COLUMN(A$1))
Put in B1 copy over 3 columns and down 3 rows.
The *3 is the number of columns desired.

Soccer Results: Count wins when 4 or more goals scored by speciied team

I have the following in excel:
A B C D E
1 Arsenal 3 v 2 Liverpool
2 Arsenal 4 v 1 Chelsea
3 Liverpool 1 v 1 Spurs
4 Arsenal 3 v 0 Stoke
5 Arsenal 6 v 2 Huddersfield
What I would like to do is count how many occasions Arsenal won then game when they scored 4 or more goals. In the example above I would need to return "2" as they beat Chelsea 4-1 and Huddersfield 6-2.
I have tried countifs, sumifs, sumproducts but I am going round in circles.
Any help would be appreciated. Many thanks, Alan.
If Arsenal can only be in column A then you can use this formula
=SUMPRODUCT((A1:A5="Arsenal")*(B1:B5>D1:D5)*(B1:B5>=4))
....or if Arsenal could also appear in column E (as away team?) then you can use this version
=SUMPRODUCT((A1:A5="Arsenal")*(B1:B5>D1:D5)*(B1:B5>=4)+(E1:E5="Arsenal")*(D1:D5>B1:B5)*(D1:D5>=4))
Countifs() is the formula you need. These are the conditions:
COLUMN A = ARSENAL
COLUMN B > COLUMN D
COLUMN B > 3
Read the documentation here and give it a try once again.

Sum Column that matches a given criteria in Excel

How would I sum vertically the columns that meet a given criteria?
For example:
A B C D E F G
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
If criteria = A, then the formula would give me 4
if B, 8
if C, 12. I would like the criteria input to be a reference-able cell.
Thanks for your help!
Use INDEX to return the correct array. Use MATCH to return the correct column:
=SUM(INDEX(2:5,0,MATCH(J1,1:1,0)))
Assuming you have a sheet like this:
=SUM(INDEX($BF$5:$BI$16,,Match($BC$5,$BF$4:$BI$4,0)))

Allocate class based on school ranking

In Excel I am trying to allocate classes to pupils based on their ranking in school. The set of data I have looks like this:
S/N Name LevelPosition
1 Andrea 10
2 Bryan 25
3 Catty 5
4 Debbie 26
5 Ellie 30
6 Freddie 28
I would like to have a formula that could sort the pupils based on the LevelPosition and allocate the class in order of this sequence - A,B,C,C,B,A. Hence the result would be:
S/N Name LevelPosition AllocatedClass
3 Catty 5 A
1 Andrea 10 B
2 Bryan 25 C
4 Debbie 26 C
6 Freddie 28 B
5 Ellie 30 A
This was the sort of thing I had in mind.
Column D is just a ranking from bottom to top:-
=RANK(C2,C$2:C$7,1)
Colum D is adjusted for any ties:-
=D2+COUNTIF(D$1:D1,D2)
Column E is based on the #pnuts formula:-
=CHOOSE(MOD(E2-1,6)+1,"A","B","C","C","B","A")
I've put some ties in to show what would happen. The last two students' allocations are reversed because the second to last has the higher mark.

Resources