+ Reply to Thread
Results 1 to 10 of 10

Dynamic formula to determine MAX $$ values (based on year & quarter)

  1. #1
    Forum Contributor
    Join Date
    08-06-2018
    Location
    Virginia
    MS-Off Ver
    2019
    Posts
    342

    Dynamic formula to determine MAX $$ values (based on year & quarter)

    Experts:

    I need some assistance with creating a dynamic formula which will determine the MAX value based on a date range (year/quarter in a summary matrix).

    Please see attached XLSX which contains some sample data as well as the details... see summary below.

    What I Currently Have:
    - Dates in column A
    - $$ values in column B
    - MAX $$ values for each quarter (Q1-Q4 for 2019 and Q1-Q4 for 2020) in column C
    - Summary matrix in cell range F1:H5 where I display the MAX values for each of the (currently) 8 quarters... linked to the formulas in column C

    What I What to Change/Achieve:
    - Get rid of the MAX $$ calculations in column C where each quarter is based on a different number of "records" (dates).
    - Add a *dynamic* formula in G2:H5 which will lookup the column header (e.g., "2019" or "2020") in G1 and H1 AND the row header (Q1:Q4) in F2:F5...
    - ... and then, based on the intersection of, e.g., "2019 & Q1", automatically determine the date range (i.e., cells A2:A6) ...
    -... and then determine the MAX value for those dates.

    How can this be accomplished?

    Thank you,
    EEH
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,782

    Re: Dynamic formula to determine MAX $$ values (based on year & quarter)

    F2=IFERROR(AGGREGATE(14,6,$B$2:$B$45/(YEAR($A$2:$A$45)=F$1)/($C$2:$C$45=$E2),1),"")

    Copy across and down


    without quarter column


    F13=IF($I13<>"",AGGREGATE(14,6,$B$2:$B$45/(MONTH($A$2:$A$45)>=MONTH($I13&0))/(MONTH($A$2:$A$45)<=MONTH($J13&0))/(YEAR($A$2:$A$45)=F$12),1),"")

    copy across and down
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Dynamic formula to determine MAX $$ values (based on year & quarter)

    in F2

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  4. #4
    Forum Contributor
    Join Date
    08-06-2018
    Location
    Virginia
    MS-Off Ver
    2019
    Posts
    342

    Re: Dynamic formula to determine MAX $$ values (based on year & quarter)

    CARACALLA -- thank you... your solution is perfect!

    John -- your alternative solution works well, too.

    I appreciate both of the solutions!!

  5. #5
    Forum Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,293

    Re: Dynamic formula to determine MAX $$ values (based on year & quarter)

    Power Query
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    08-06-2018
    Location
    Virginia
    MS-Off Ver
    2019
    Posts
    342

    Re: Dynamic formula to determine MAX $$ values (based on year & quarter)

    Hello Czeslaw -- thanks for chiming in.

    I'm not too familiar with PowerQuery... but I'm willing to consider it as well.

    For testing purposes only, I have done the following:
    - Expanded the row source (range) down to row #46.
    - Added a new date within 2020-Q4.
    - Added $1000 as it new value... this should have replaced the 2020-Q4 value; however, it did NOT.

    Not sure if I missed something but expanding the table range should automatically pick up any MAX values (w/o having to modify potential PowerQuery code). Same applies when I create a new year, etc.

    Again, I'm willing to consider it but thus far, the other 2 solutions work great while the PowerQuery appears to require additional settings/modifications.

  7. #7
    Forum Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,293

    Re: Dynamic formula to determine MAX $$ values (based on year & quarter)

    Data--->Refresh All
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    08-06-2018
    Location
    Virginia
    MS-Off Ver
    2019
    Posts
    342

    Re: Dynamic formula to determine MAX $$ values (based on year & quarter)

    I appreciate the info. While this process works, I (as a user) have NOT been "converted" to the PowerQuery process.

    - Refresh should be automatic (IMHO)
    - Refresh changes the format (e.g., narrow column width).

    Again, thank you for offering this alternative, but the old-fashioned method appears to work better for me.

  9. #9
    Forum Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,293

    Re: Dynamic formula to determine MAX $$ values (based on year & quarter)

    Formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    08-06-2018
    Location
    Virginia
    MS-Off Ver
    2019
    Posts
    342

    Re: Dynamic formula to determine MAX $$ values (based on year & quarter)

    Czeslaw -- this is a nice alternative. It doesn't require the helper column (Q1-Q4).

    Thank you,
    Tom
    Last edited by skydivetom; 12-05-2021 at 07:13 AM.

+ 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. Lookup / Countifs / Averageifs based on Quarter & Year
    By cartica in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-22-2021, 08:15 PM
  2. Replies: 1
    Last Post: 08-21-2020, 06:41 AM
  3. [SOLVED] Determine oldest combi of year and quarter and put related value to cell Hi there
    By Robert1311 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-07-2018, 02:06 AM
  4. Determine most recent combi of year and quarter and put related value to cell
    By Robert1311 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-26-2018, 03:31 AM
  5. Year | Quarter Formula
    By mphillips in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-16-2017, 12:02 AM
  6. Replies: 1
    Last Post: 04-20-2015, 12:11 PM
  7. Determine Quarter & Year
    By Kolacube in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-25-2008, 07:02 AM

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