Sum values based on two criterias, one horizontal and the other vertical

Rick__

New Member
Joined
Mar 18, 2016
Messages
20
Hi,

I'm sorry to post this as I'm sure someone will be able to answer this in a flash. But I have had a look through the forum and online and still couldn't quite find the answer I was looking for, which is the reason I'm reaching out, thank you in advance.

I'm trying create a formula which will sum a set of values based on two criterias, one which is vertical and the other horizontal, see table below.



[TABLE="class: grid, width: 300, align: center"]
<tbody>[TR]
[TD]A
[/TD]
[TD="align: center"]B
[/TD]
[TD="align: center"]C
[/TD]
[TD="align: center"]D
[/TD]
[TD="align: center"]E
[/TD]
[TD="align: center"]F
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]Name
[/TD]
[TD]Dept
[/TD]
[TD]01/01/18
[/TD]
[TD]02/01/18
[/TD]
[TD]03/01/18
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]John
[/TD]
[TD]IT
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]2
[/TD]
[TD="align: center"]0
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]Sue
[/TD]
[TD]IT
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"]1
[/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]Paul
[/TD]
[TD]HR
[/TD]
[TD="align: center"]2
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"]1
[/TD]
[/TR]
[TR]
[TD]5
[/TD]
[TD]Steve
[/TD]
[TD]HR
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]1
[/TD]
[TD="align: center"]2
[/TD]
[/TR]
</tbody>[/TABLE]

I'm trying to sum the values of a Dept on a certain day, so it will look something like the below table.


[TABLE="class: grid, width: 300"]
<tbody>[TR]
[TD]Date
[/TD]
[TD]IT
[/TD]
[TD]HR
[/TD]
[/TR]
[TR]
[TD]01/01/18
[/TD]
[TD]2
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD]02/01/18
[/TD]
[TD]2
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]03/01/18
[/TD]
[TD]1
[/TD]
[TD]3
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
With your first table on Sheet1 and your output table on Sheet 2 and Sheet2!A1=Date
Put your dates in Sheet2 column A
Put your Depts in Sheet2 row 1
So you ve now got headers in Sheet 2column A and row 1

in Sheet2!B2
=SUMPRODUCT((Sheet1!C$2:C$5=B$1)*(Sheet1!$D$1:$F$1=$A2)*(Sheet1!$D$2:$F$5))
and copy across and down
 
Last edited:
Upvote 0
I had another question based on the similar data set, on the first sheet I have to sum had numbers as well as text/Letter, how could I get round this.

1. I would like just add all the numbers together.

2. depending on the text/Letter, I would need to count the number of times a particular letter appears in a column.

Thank you in advance
 
Upvote 0

Book1
ABCDEFGHI
1NameDept1/1/20182/1/20183/1/2018DateITHR
2JohnIT1201/1/201823
3SueIT1012/1/201821
4PaulHR2013/1/201813
5SteveHR112
Sheet1

In H2 enter, copy across, and down:

=SUMIFS(INDEX($C$2:$E$5,0,MATCH($G2,$C$1:$E$1,0)),$B$2:$B$5,H$1)
 
Upvote 0
I just had one more question on the same senario, I'm trying to do the same senario above but count the number of times a letter "H" appears in the data.

I've tried to convert the SUMIFS fourmula below to a COUNTIFS but it hasn't worked, thank you in advance.

=SUMIFS(INDEX($C$2:$E$5,0,MATCH($G2,$C$1:$E$1,0)),$B$2:$B$5,H$1)
 
Upvote 0
I just had one more question on the same senario, I'm trying to do the same senario above but count the number of times a letter "H" appears in the data.

I've tried to convert the SUMIFS fourmula below to a COUNTIFS but it hasn't worked, thank you in advance.

=SUMIFS(INDEX($C$2:$E$5,0,MATCH($G2,$C$1:$E$1,0)),$B$2:$B$5,H$1)


Do you mean the following?


=COUNTIFS(INDEX($C$2:$E$5,0,MATCH($G2,$C$1:$E$1,0)),"H",$B$2:$B$5,H$1)
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top