Week to Date / Month to Date Calculations (by providing only a single date)

kmaxx98

New Member
Joined
Jun 17, 2012
Messages
14
Good afternoon,

Hoping someone out there has a nice offset formula to help me out here in excel 2010.

I have an annual list of data by date. If I provide only one date from a drop down menu, is there a way for it to recognize the first Monday of that week and sum all values from that Monday?

Likewise, and probably easier, is there a way to get it to recognize the first day of the month, and sum from there?

For the example below, the desired output would be:

WTD=15
MTD=21

Data</SPAN>Input</SPAN>Output</SPAN>
Date</SPAN>Day</SPAN>Value</SPAN>Work Date</SPAN>WTD Sum</SPAN>MTD Sum</SPAN>
29-May</SPAN>Tue</SPAN>10</SPAN>6-Jun</SPAN>??</SPAN>??</SPAN>
30-May</SPAN>Wed</SPAN>15</SPAN>
31-May</SPAN>Thu</SPAN>16</SPAN>
1-Jun</SPAN>Fri</SPAN>1</SPAN>
2-Jun</SPAN>Sat</SPAN>2</SPAN>
3-Jun</SPAN>Sun</SPAN>3</SPAN>
4-Jun</SPAN>Mon</SPAN>4</SPAN>
5-Jun</SPAN>Tue</SPAN>5</SPAN>
6-Jun</SPAN>Wed</SPAN>6</SPAN>
7-Jun</SPAN>Thu</SPAN>7</SPAN>
8-Jun</SPAN>Fri</SPAN>8</SPAN>
9-Jun</SPAN>Sat</SPAN>9</SPAN>

<TBODY>
</TBODY><COLGROUP><COL span=3><COL><COL><COL><COL><COL></COLGROUP>
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
See if this works for you:
Excel Workbook
ABCDEFGH
1DateDayValueWork DateWTD SumMTD Sum
229-MayTue106-Jun1521
330-MayWed15
431-MayThu16
51-JunFri1
62-JunSat2
73-JunSun3
84-JunMon4
95-JunTue5
106-JunWed6
117-JunThu7
128-JunFri8
139-JunSat9
1410-JunSun10
1511-JunMon11
1612-JunTue12
Sheet
 
Upvote 0
Thanks Ahoy!

Could you explain to me how that works?

See if this works for you:

ABCDEFGH
1Date Day Value Work Date WTD Sum MTD Sum
229-MayTue 10 6-Jun 1521
330-MayWed 15
431-MayThu 16
51-JunFri 1
62-JunSat 2
73-JunSun 3
84-JunMon 4
95-JunTue 5
106-JunWed 6
117-JunThu 7
128-JunFri 8
139-JunSat 9
1410-JunSun 10
1511-JunMon 11
1612-JunTue 12

<COLGROUP><COL style="WIDTH: 30px; FONT-WEIGHT: bold"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"></COLGROUP><TBODY>
</TBODY>

Spreadsheet Formulas
CellFormula
G2=SUMIFS(C2:C16,A2:A16,">="&DATE(YEAR(E2),MONTH(E2),DAY(E2)-WEEKDAY(E2,2)+1),A2:A16,"<="&E2)
H2=SUMIFS(C2:C16,A2:A16,">="&EOMONTH(E2,-1)+1,A2:A16,"<="&E2)

<TBODY>
</TBODY>

<TBODY>
</TBODY>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0
For the WTD

The first criteria in the SUMIFS finds the Monday of the week.
DATE(YEAR(E2),MONTH(E2),DAY(E2)-WEEKDAY(E2,2)+1)

I used the DATE function to find the year & Month you wanted.
The DAY function returns 6 in this example (which is Wed.)

The Weekday function with a return value of 2 assigns a number to the weekdays in this case the 2 assigns 1=Monday thru 7=Sunday.
So in this case the WEEKDAY function assigns 3 to Wed and subtracts it from 6 which gives you 6/3/12 which is Sunday and the +1 just adds 1 to the date which will give you the Monday that you wanted to start on.

Criteria 2 in the SUMIFS just tells the function to add all values up to and equal to the date.

For the MTD :

Criteria 1 finds the first day of the month.<o:p></o:p>
I used the end of month function<o:p></o:p>
<o:p> </o:p>
EOMONTH(E2,-1)+1<o:p></o:p>
<o:p> </o:p>
The -1 finds the last day of the previous month 5/31/12 in this case.<o:p></o:p>
+1 adds 1 day to give 6/1/12.<o:p></o:p>
<o:p> </o:p>
Hope this helps.<o:p></o:p>

 
Upvote 0

Forum statistics

Threads
1,207,261
Messages
6,077,356
Members
446,279
Latest member
hoangquan2310

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