+ Reply to Thread
Results 1 to 8 of 8

Formula for returning sum of values for three months depending on the end date of a cell

  1. #1
    Registered User
    Join Date
    01-25-2021
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    8

    Question Formula for returning sum of values for three months depending on the end date of a cell

    Hi, I have a pretty difficult situation that I need help solving.

    I have a large data table with several companies and different metrics per quarter like net sales, EBITDA, EPS, etc. There is a column for company, fiscal year, fiscal quarter, calendar ending date, metric name, and value. There are more columns, but I believe these will be the only ones relevant for now. Not every company follows the calendar year for their fiscal year, and not every company follows the same fiscal year as my company does. I need a formula that will show the value of three summed months for a metric (EPS, for example) that will follow the quarter for a specific company.

    So, I believe that the calendar ending date will come into play. Depending on the month listed in this cell, the formula will count back to include the three previous months. It will use that time frame to look up the values for those three months in my company and add them together. (This will either come from a separate file or a separate worksheet.) Then it will return that summation of those three months values in the new column.

    Any ideas are how I can get this started?

    Very appreciated.

    Note: I will be unable to share my files. I suppose if this is absolutely necessary, I could create a very small sample to give a visual of what was already put in words. I do not believe this should be necessary, however.

  2. #2
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Formula for returning sum of values for three months depending on the end date of a ce

    Quote Originally Posted by amconnel View Post

    Note: I will be unable to share my files. I suppose if this is absolutely necessary, I could create a very small sample to give a visual of what was already put in words. I do not believe this should be necessary, however.
    I think this is quite necessary...

  3. #3
    Registered User
    Join Date
    01-25-2021
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Formula for returning sum of values for three months depending on the end date of a ce

    Please see attached. I have edited the file so that fiscal year and quarter are now in the same column.

    You can see four different competitors on the first sheet, and my company 'Home' on the second sheet. You will also see that no fiscal quarter end is alike except between competitors A and D.
    Please think of this example to further understand the kind of formula I am needing:

    I need to add a column to the competitors sheet. Let's look at Competitor B. I want to look up what the matching metric is for each segment for Competitor B's third quarter.
    This quarter runs from July to September. If you look at the 'Home' tab, you will see that Competitor B's third quarter includes the last month of our third quarter and the
    first two months of our fourth quarter. I want the monthly values to be added together and this be what is returned on the 'Competitors' tab.

    In cell G26, I want 203.74 to be returned. The formula should find that the months of the Home company that fall within Competitor B's third quarter are July through September.
    Then it should look for the EPS values that fall within the correct segment (in this case, bread) and sum the values that fit all criteria.

    The function will likely not work for many instances as this data set is rather small and random. I simply cannot share my original data and also cannot spend hours creating a fake data set.
    I do hope this gives you a better understanding. Feel free to edit things within this file accordingly to allow a formula to better show functionality.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Formula for returning sum of values for three months depending on the end date of a ce

    Hi,
    can you explain why would D8 in "home" tab is considered Q3 if the date id 1/10 ?

  5. #5
    Registered User
    Join Date
    01-25-2021
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Formula for returning sum of values for three months depending on the end date of a ce

    It may not be - would need to check with some higher ups. But this ending date would account for 9/2/2020 through 10/1/2020 and we do want that September data. The 'Home' Calendar Ending Date is just formatted differently than Competitor ending dates.

  6. #6
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Formula for returning sum of values for three months depending on the end date of a ce

    OK, so I would suggest you create a helper table like I did in 'competitor' sheet to define the quarters starting and ending dates.

    Then use this in G26:
    =SUMPRODUCT((Home!$D$2:$D$25>=VLOOKUP(C26,$L$2:$N$4,2,0))*((B26=Home!$B$2:$B$25))*(Home!$D$2:$D$25<=VLOOKUP(C26,$L$2:$N$4,3,0))*(Home!$F$2:$F$25))


    Let me know if this solves your problem...
    Attached Files Attached Files

  7. #7
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: Formula for returning sum of values for three months depending on the end date of a ce

    Assuming all dates are ending date of months
    Try in G26:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Quang PT

  8. #8
    Registered User
    Join Date
    01-25-2021
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Formula for returning sum of values for three months depending on the end date of a ce

    This almost works. It may be an error on my end, but when I use this in the original file and check, the numbers are not summed quite to where they need to be. I made some adjustments and believe I found the correct way, but is there a way to do this power query within excel? Don't have much experience with Power Query here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Calculate a date depending on a number of months
    By jk2391 in forum Excel General
    Replies: 1
    Last Post: 06-10-2020, 05:28 PM
  2. [SOLVED] DATEDIF Formula returning the same value for two different months
    By Sherran in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 05-30-2019, 04:54 PM
  3. Returning different values if cell falls between a certain date range
    By mlstutesman in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-23-2015, 12:11 PM
  4. Excel 2007 : Changing values in a cell depending on date
    By Matso_Kai in forum Excel General
    Replies: 3
    Last Post: 05-27-2010, 08:23 AM
  5. Returning Values of Different Cells Depending on Conditions
    By laffers in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-19-2010, 10:19 AM
  6. Copy cell values depending on date (Month) in two files
    By salmanisn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-04-2010, 07:45 AM
  7. [SOLVED] FORMULA TO INCREMENT 25 MONTHS BASED ON A DATE CELL
    By SorianoP in forum Excel General
    Replies: 4
    Last Post: 08-14-2006, 06:50 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1