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.



A
B
C
D
E
F
1
Name
Dept
01/01/18
02/01/18
03/01/18
2
John
IT
1
2
0
3
Sue
IT
1
0
1
4
Paul
HR
2
0
1
5
Steve
HR
1
1
2

<tbody>
</tbody>

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


Date
IT
HR
01/01/18
2
3
02/01/18
2
1
03/01/18
1
3

<tbody>
</tbody>
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
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,220,965
Messages
6,157,119
Members
451,399
Latest member
alchavar

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