Excel - Sumif only in the first line of a date

AttAtt

New Member
Joined
Sep 16, 2018
Messages
3
hey all ,


im new here :)


i need to make sumif by date but only in the first line of the date .
if there is duplicate date dont make sum if just insert 0.
in the pic you can see in column C the result that i need

date
number

<tbody>
</tbody>
result

<tbody>
</tbody>
1/2/2018
1/2/2018
1/3/2018
1/3/2018
1/4/2018
1/4/2018
1/5/2018
1/5/2018
1/5/2018
1/17/2018
1/17/2018
1/19/2018
1/19/2018
1/19/2018

<colgroup><col></colgroup><tbody>
</tbody>
0
73.48
0
139.48
0
-153.12
0
-115.78
-99.18
0
240.68
0
169.6866
231.4534

<colgroup><col width="64" style="width:48pt"> </colgroup><tbody>
</tbody>
73.48
0
139.48
0
-153.12
0
-214.96
0
0
240.68
0
401.14
0
0

<colgroup><col width="64" style="width:48pt"> </colgroup><tbody>
</tbody>

<tbody>
</tbody>
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hi,

Try this :

C2 =IF(B2=0,SUMIF($A$2:$A$15,A2,$B$2:$B$15),0)



ABC
1DateNumberResult
2 1/2/2018

0
73.48
31/2/201873.480
41/3/20180139.48
51/3/2018139.480
61/4/20180-153.12
71/4/2018-153.120
81/5/20180-214.96
91/5/2018-115.780
101/5/2018-99.180
111/17/20180240.68
121/17/2018240.680
131/19/20180401.14
141/19/2018169.68660
151/19/2018231.45340

<colgroup><col width="70" span="4" style="width:52pt"> </colgroup><tbody>
</tbody>
 
Upvote 0
Hi,

Try this :

C2 =IF(B2=0,SUMIF($A$2:$A$15,A2,$B$2:$B$15),0)



ABC
1DateNumberResult
2 1/2/2018 073.48
31/2/201873.480
41/3/20180139.48
51/3/2018139.480
61/4/20180-153.12
71/4/2018-153.120
81/5/20180-214.96
91/5/2018-115.780
101/5/2018-99.180
111/17/20180240.68
121/17/2018240.680
131/19/20180401.14
141/19/2018169.68660
151/19/2018231.45340

<tbody>
</tbody>

Hey ,
thanks for the answer ,
there is a problem in those lines :

8/30/2018
8/30/2018
8/30/2018

<colgroup><col></colgroup><tbody>
</tbody>
0
0
-49.8

<colgroup><col width="64" style="width:48pt"> </colgroup><tbody>
</tbody>
-49.8
-49.8
0

<colgroup><col width="64" style="width:48pt"> </colgroup><tbody>
</tbody>

<tbody>
</tbody>

in column C i expected to get -49.8 only in the first row

Thanks
 
Upvote 0
Try this : (leave the header in column C empty)

C2 =IF(AND(B2=0,C1=0),SUMIF($A$2:$A$18,A2,$B$2:$B$18),0)

ABC
1DateNumber
201/02/18073.48
301/02/1873.480
401/03/180139.48
501/03/18139.480
601/04/180-153.12
701/04/18-153.120
801/05/180-214.96
901/05/18-115.780
1001/05/18-99.180
111/17/20180240.68
121/17/2018240.680
131/19/20180401.14
141/19/2018169.68660
151/19/2018231.45340
16 8/30/2018

0
-49.8
178/30/201800
188/30/2018-49.8 0

<colgroup><col width="70" span="4" style="width:52pt"> </colgroup><tbody>
</tbody>
 
Upvote 0
Hi,

This will do what you want regardless of how many dates are 0 (zero) before there's a number in Column B, no need to remove Headers:


Book1
ABC
1datenumberresult
21/2/2018073.48
31/2/201873.480
41/3/20180139.48
51/3/2018139.480
61/4/20180-153.12
71/4/2018-153.120
81/5/20180-214.96
91/5/2018-115.780
101/5/2018-99.180
111/17/20180240.68
121/17/2018240.680
131/19/20180401.14
141/19/2018169.68660
151/19/2018231.45340
168/30/20180-49.8
178/30/201800
188/30/201800
198/30/2018-49.80
Sheet262
Cell Formulas
RangeFormula
C2=IF(COUNTIF(A$2:A2,A2)=1,SUMIF(A$2:A$19,A2,B$2:B$19),0)


Formula copied down.
 
Upvote 0
Hi,

This will do what you want regardless of how many dates are 0 (zero) before there's a number in Column B, no need to remove Headers:

ABC
1datenumberresult
21/2/2018073.48
31/2/201873.480
41/3/20180139.48
51/3/2018139.480
61/4/20180-153.12
71/4/2018-153.120
81/5/20180-214.96
91/5/2018-115.780
101/5/2018-99.180
111/17/20180240.68
121/17/2018240.680
131/19/20180401.14
141/19/2018169.68660
151/19/2018231.45340
168/30/20180-49.8
178/30/201800
188/30/201800
198/30/2018-49.80

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet262

Worksheet Formulas
CellFormula
C2=IF(COUNTIF(A$2:A2,A2)=1,SUMIF(A$2:A$19,A2,B$2:B$19),0)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



Formula copied down.

Thanks alot ! its Work !
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,483
Members
448,967
Latest member
visheshkotha

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