sum the range in dates if column condition is true

pmbt18

New Member
Joined
Apr 3, 2018
Messages
3
The data entered are as follows :

Total 5 4 6 6
Date 2/3/18 3/3/18 4/3/18 5/3/18
Apples 2 3 2 4
Oranges 3 1 4 2

In the first row, I sum the columns for the number of fruits for the particular date.

I need to display the following :
Category FromDate ToDate Answer
Apples 2/3/18 4/3/18 7

What should I do to get the answer 7?
If I select Oranges, it will display 8.
I tried sumif but I can only sum the total according to the from/to dates but I cannot sum if a category is selected.
Can anyone help??
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Excel 2016 (Windows) 32 bit
ABCDE
1Total5448
2Date2/3/20183/3/20184/3/20185/3/2018
3Apples2324
4Oranges3124
5
6CategoryFromUntilTotal
7Apples2/3/20184/3/20187
Sheet4
Cell Formulas
RangeFormula
D7{=SUM(INDEX(B3:E4,MATCH(A7,A3:A4),N(IF(1,ROW(INDIRECT("A"&MATCH(B7,B2:E2,1)&":A"&MATCH(C7,B2:E2,1)))))))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Last edited:
Upvote 0
Maybe something like this...


[Table="class: grid"][tr][td="bgcolor: #DCE6F1"][/td][td="bgcolor: #DCE6F1"]
A
[/td][td="bgcolor: #DCE6F1"]
B
[/td][td="bgcolor: #DCE6F1"]
C
[/td][td="bgcolor: #DCE6F1"]
D
[/td][td="bgcolor: #DCE6F1"]
E
[/td][/tr]
[tr][td="bgcolor: #DCE6F1"]
1
[/td][td]
Total​
[/td][td]
5​
[/td][td]
4​
[/td][td]
6​
[/td][td]
6​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
2
[/td][td]
Date​
[/td][td]
02/03/2018​
[/td][td]
03/03/2018​
[/td][td]
04/03/2018​
[/td][td]
05/03/2018​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
3
[/td][td]
Apples​
[/td][td]
2​
[/td][td]
3​
[/td][td]
2​
[/td][td]
4​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
4
[/td][td]
Oranges​
[/td][td]
3​
[/td][td]
1​
[/td][td]
4​
[/td][td]
2​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
5
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
6
[/td][td]
Category​
[/td][td]
From​
[/td][td]
Until​
[/td][td]
Total​
[/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
7
[/td][td]
Apples​
[/td][td]
02/03/2018​
[/td][td]
04/03/2018​
[/td][td]
7​
[/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
8
[/td][td]
Oranges​
[/td][td]
02/03/2018​
[/td][td]
04/03/2018​
[/td][td]
8​
[/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
9
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]


Formula in D7 copied down
=SUMIFS(INDEX($B$3:$E$4,MATCH(A7,$A$3:$A$4,0),0),$B$2:$E$2,">="&B7,$B$2:$E$2,"<="&C7)

M.
 
Upvote 0
Maybe something like this...


[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: #DCE6F1"][/TD]
[TD="bgcolor: #DCE6F1"]
A
[/TD]
[TD="bgcolor: #DCE6F1"]
B
[/TD]
[TD="bgcolor: #DCE6F1"]
C
[/TD]
[TD="bgcolor: #DCE6F1"]
D
[/TD]
[TD="bgcolor: #DCE6F1"]
E
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
1
[/TD]
[TD]
Total​
[/TD]
[TD]
5​
[/TD]
[TD]
4​
[/TD]
[TD]
6​
[/TD]
[TD]
6​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
2
[/TD]
[TD]
Date​
[/TD]
[TD]
02/03/2018​
[/TD]
[TD]
03/03/2018​
[/TD]
[TD]
04/03/2018​
[/TD]
[TD]
05/03/2018​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
3
[/TD]
[TD]
Apples​
[/TD]
[TD]
2​
[/TD]
[TD]
3​
[/TD]
[TD]
2​
[/TD]
[TD]
4​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
4
[/TD]
[TD]
Oranges​
[/TD]
[TD]
3​
[/TD]
[TD]
1​
[/TD]
[TD]
4​
[/TD]
[TD]
2​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
5
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
6
[/TD]
[TD]
Category​
[/TD]
[TD]
From​
[/TD]
[TD]
Until​
[/TD]
[TD]
Total​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
7
[/TD]
[TD]
Apples​
[/TD]
[TD]
02/03/2018​
[/TD]
[TD]
04/03/2018​
[/TD]
[TD]
7​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
8
[/TD]
[TD]
Oranges​
[/TD]
[TD]
02/03/2018​
[/TD]
[TD]
04/03/2018​
[/TD]
[TD]
8​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
9
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Formula in D7 copied down
=SUMIFS(INDEX($B$3:$E$4,MATCH(A7,$A$3:$A$4,0),0),$B$2:$E$2,">="&B7,$B$2:$E$2,"<="&C7)

M.

Wow! I always think way too comlicated for myself!! Much better formula than my volatile and roundabout way.
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,260
Members
452,627
Latest member
KitkatToby

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