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

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

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...


A
B
C
D
E
1
Total​
5​
4​
6​
6​
2
Date​
02/03/2018​
03/03/2018​
04/03/2018​
05/03/2018​
3
Apples​
2​
3​
2​
4​
4
Oranges​
3​
1​
4​
2​
5
6
Category​
From​
Until​
Total​
7
Apples​
02/03/2018​
04/03/2018​
7​
8
Oranges​
02/03/2018​
04/03/2018​
8​
9

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...


A
B
C
D
E
1
Total​
5​
4​
6​
6​
2
Date​
02/03/2018​
03/03/2018​
04/03/2018​
05/03/2018​
3
Apples​
2​
3​
2​
4​
4
Oranges​
3​
1​
4​
2​
5
6
Category​
From​
Until​
Total​
7
Apples​
02/03/2018​
04/03/2018​
7​
8
Oranges​
02/03/2018​
04/03/2018​
8​
9

<tbody>
</tbody>


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,214,392
Messages
6,119,257
Members
448,880
Latest member
aveternik

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