Moving Month to date Formula or Macro

chrisscauk

New Member
Joined
Jul 25, 2013
Messages
1
Hey,

So we have a daily energy sheet which picks up readings from other spreadsheets to calculate production vs energy on site.

We want to calculate the sum of tonnage produced month to date - the current day as this leaves a negative number.


So in column A we have the all the dates by day. The title start at Row 6 with data below and line 7 frozen.

Date</SPAN>PM1 tonnage</SPAN>
01-Jun-13

<COLGROUP><COL style="WIDTH: 48pt" width=64><TBODY>
</TBODY>
70.17

<COLGROUP><COL style="WIDTH: 48pt" width=64><TBODY>
</TBODY>

<TBODY>
</TBODY>


So for example if it was 20th June 2013 today I need a formula that will recognise the month is June 2013 and only sum the months tonnage from the 1st June 2013 to the 20th June 2013, but then tomorrow it will be from the 1st June 2013 up to 21st June 2013. Then when the month changes to July it would need to recognise that the month has changed and this will take up the entire column from Row 7.

So in turn it needs to recognise the current month and sum from the first of the current month up to the current Date. A formula would be preferred but a macro would do.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
pivot table any use ?

=SUMPRODUCT((MONTH(A7:A100)=7)*(B7:B100))
or instead of 7 you could use today()
=SUMPRODUCT((MONTH(A7:A100)=MONTH(TODAY()))*(B7:B100))
but that does not take into account the year
 
Upvote 0

Forum statistics

Threads
1,215,963
Messages
6,127,951
Members
449,412
Latest member
montand

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