Automatically calculate YTD from data in pivot table

monaldo12

New Member
Joined
Mar 17, 2016
Messages
45
Hi,

I have a pivot table with weeknumbers and sales over 2 years. However the currect year is updated every 4 weeks so the data is expending for year 2020, 2019 is already filled in till week 52. I would like to calculate the YTD sum of the current year 2020, but also of the past year 2019. So both I need a YTD sum till W02 for example. Is there a formula for this?
Additional question, can I also make a sum of the last two weeks depending on the latest week available in 2020? So I need a automatic sum of 2019 which is 200 and for 2020 of 240. By adding more data to year 2020 it needs to switch in the future to a sum of W5+W6, later to W10+W11 etc etc.

week/year20192020
W01100120
W02100120
W03100
 

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

Forum statistics

Threads
1,214,653
Messages
6,120,749
Members
448,989
Latest member
mariah3

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