YTD Calculation using dynamic columns and conditions

mrxell

New Member
Joined
Jul 24, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi folks, I am badly stuck with an excel calculation for YTD numbers, where the start date and end date are variable. The columns are in columns another input tab. I want to be able to fetch the YTD data by customer/produc/distributor, etc. where these are the conditions dependend on another input file. Already spent so many hours figuring out the solution but no use.. FYI, i tried Sumif Index Match combinations, Sumif offset combination, sumif xlookup combination but all failed as they cannot sum the range of columns rather just work on adding two columns for the start and end date. Attaching sample data file for reference.. Someone pleaseeeee help!

Input FIle: Mothly data is from col E to AL starting Sep 2020 to Jun 2023
Output required: YTD based on YTD Start CY and CY in output tab
 

Attachments

  • Output.png
    Output.png
    46.4 KB · Views: 47
  • Input.png
    Input.png
    57.7 KB · Views: 51

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
I'm not sure this is a complete solution. But it may get you started down the path. I would suggest using the xl2bb add in (link below) to help the forum help you. The forum needs to recreate your scenario and that takes time and can have unknown errors and errors in assumptions. For instance, your cross tabs have fields that are not explained and where they come from.

If you cannot use the xl2bb, then posting a table of data would be helpful.

But, below is a solution, I think for one of your #REF errors. Although I'm not certain it is what you want.

Best wishes.



Book1
ABCDEFGHIJK
1
2
3CountryDistributorProductSource2020-09-012020-10-012020-11-012023-04-012023-05-012023-06-01
4Country1Distributor1Product1New Customer495495495611611611
5Country2Distributor2Product2Price Increase000000
6Country3Distributor3Product3New Customer000000
7Country4Distributor4Product4Price Increase000000
8Country5Distributor5Product5New Customer495495495611611572
9Country6Distributor6Product6Price Increase495495495611611572
10Country7Distributor7Product7Price Increase000000
11
12
13
14
15New Customers by Distributor2020-09-012020-10-012020-11-012023-04-012023-05-012023-06-01
16Distributor1495495495611611611
17Distributor3000000
18Distributor5495495495611611572
19
20
21
22
23
24
25
26New Customers by Product
27Product1495495495611611611
28Product3000000
29Product5495495495611611572
30
31
Sheet1
Cell Formulas
RangeFormula
B16:B18B16=TAKE(FILTER($B$4:$D$10,(D4:D10="New Customer")),,1)
E16:J18E16=SUMIFS(E$4:E$10,$B$4:$B$10,$B16)
B27:B29B27=CHOOSECOLS(FILTER($B$4:$D$10,(D4:D10="New Customer")),2)
E27:J29E27=SUMIFS(E$4:E$10,$C$4:$C$10,$B27)
Dynamic array formulas.
 
Upvote 0
Thank you so much for your response. I am actually unable to install the xl2bb add-in as my computer says "this file type is not supported in protected view", tried looking for some solutions but could not. However, I am looking for help with YTD column (Col i & J) in the output tab, where the COl I should provide the sum of all columns ranging between C1 and C2 plus matching the distributor type in A20, Source in cell C4. Sharing the copy of the data table for your perusal. Kindly help!

Input table

CountryDistributorProductSource
Sep-20​
Oct-20​
Nov-20​
Apr-23​
May-23​
Jun-23​
Country 1Distributor 1Product 1New Customer
495​
495​
495​
611​
611​
611​
Country 2Distributor 2Product 2Price Increase
0​
0​
0​
0​
0​
0​
Country 3Distributor 3Product 3New Customer
0​
0​
0​
0​
0​
-39​
Country 4Distributor 4Product 4Price Increase
0​
0​
0​
0​
0​
0​
Country 5Distributor 5Product 5New Customer
495​
495​
495​
611​
611​
572​
Country 6Distributor 6Product 6Price Increase
495​
495​
495​
611​
611​
572​
Country 7Distributor 7Product 7Price Increase
0​
0​
0​
0​
0​
0​


Output table

CYJun-23PYJun-22
44742​
May-23YTD Start - CYApr-23YTD Start - PYMay-22
5/1/2022​
Apr-24FY End - CYApr-24FY End - PYApr-23
45046​
SourceNew Customer
New Customers
Current Month (Jun-23)Year-to-Date (Jun-23)
ActBudPYv Bgtv PYYoY%ActBudPYv Bgtv PYYoY%
New customers by product
Product 1611622
Product 2--
Product 3- 399
Product 4--
Product 5572691
Product 6--
Product 7--
Total1,1441,322-
New customers by Distributor
Distributor 1611622
Distributor 2--
Distributor 3- 399
Distributor 4--
Distributor 5572691
Distributor 6--
Distributor 7--
Total1,1441,322
New customers by country
Country 1611622
Country 2--
Country 3- 399
Country 4--
Country 5572691
Country 6--
Country 7--
Total1,1441,322
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

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