# Subtotal Question

#### fgmoon353

##### New Member
First time post, I've been searching all over the web and haven't found squat...

I'm trying to subtotal shipments by date and cost. I can do that. I also need to know the subtotal for the first 3 shipments per day. For Example. On Monday we had 6 shipments, how much were the first 3 of the day, for every day, for like the last 3 months. So it's not like I can do this manually.

Like I said, so far, I've got my spreadsheet subtotaled for date, but that's as far as I've gotten.

### Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Hello fgmoon353, welcome to MrExcel

If you have shipment date in column A, shipment time in column B and cost in column C then try this formula in D2 down to get the instance number in each day

=COUNTIFS(A:A,A2,B:B,"<"&B2)+1

now you can sum for the first 3 instances with

=SUMIF(D:D,"<=3",C:C)

use SUMIFS with more conditions if you only want that for a specific date period

[COUNTIFS and SUMIFS require Excel 2007 or later]

Thanks for the Countifs function introduction, that worked well!

When I put in the sumif function (I'm guessing I'm supposed to put it in E2) I get a grand total of ALL of the first three shipments for everyday in my spreadsheet. I need the sum of the first three per day itemized. How can I do that?

Thanks again!

Replies
1
Views
167
Replies
0
Views
199
Replies
3
Views
530
Replies
1
Views
469
Replies
2
Views
580

1,203,059
Messages
6,053,299
Members
444,650
Latest member
bookendinSA

### 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?

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