+ Reply to Thread
Results 1 to 6 of 6

Offset function with a dynamic Height range

  1. #1
    Registered User
    Join Date
    03-22-2019
    Location
    Montreal
    MS-Off Ver
    version 10
    Posts
    5

    Offset function with a dynamic Height range

    Hello

    In excel 365

    I am trying to create a dashboard of a rolling 6 month sales average.

    I am using this function =AVERAGE(OFFSET($C$1,COUNTA(Sales),0,-6,1)) where sales is a named range with sales data.

    I would like the height in offset formula currently set at -6 to be dynamic to pull in an average of 6 months or less in situations where 6 months of the fiscal year has not elapsed.

    Exe return 6 month avr or 5 months avr in currently in May or 4 month avr if currently in APR or 3 month avr if currently is March
    Attached Files Attached Files
    Last edited by mark.c; 02-09-2025 at 01:03 PM. Reason: attached doc

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,247

    Re: Offset function with a dynamic Height range

    Administrative Note:

    Is your forum profile up-to-date and showing ONLY the oldest Excel PRODUCT that you need this to work for?

    Members will tailor the solutions they offer to the Office PRODUCT (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your product is for Mac, please also state this.

    The four most recent Excel products are Excel 2019, Excel 2021, Excel 2024 and MS365 - if you are using MS365, please give this name along with the version number in your profile (e.g. MS365 Version 2306). This is in the About Excel section further down the Account page.

    Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,018

    Re: Offset function with a dynamic Height range

    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file and a mocked up solution.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Contributor
    Join Date
    01-07-2025
    Location
    Iran
    MS-Off Ver
    2021
    Posts
    137

    Re: Offset function with a dynamic Height range

    You can use this formula:

    PHP Code: 
    =AVERAGE(OFFSET($C$1,COUNTA(Sales),0,-MIN(6,COUNTA(Sales)),1)) 

  5. #5
    Registered User
    Join Date
    03-22-2019
    Location
    Montreal
    MS-Off Ver
    version 10
    Posts
    5

    Re: Offset function with a dynamic Height range

    Fantastic works. Much obliged!!!

  6. #6
    Forum Contributor
    Join Date
    01-07-2025
    Location
    Iran
    MS-Off Ver
    2021
    Posts
    137

    Re: Offset function with a dynamic Height range

    Welcome

+ 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. OFFSET, COUNTA or SHOULD BE COUNTIF Function for dynamic range for Chart
    By ahteddy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-24-2015, 10:50 AM
  2. Replies: 11
    Last Post: 01-16-2015, 07:04 PM
  3. [SOLVED] Dynamic range list issue - replace Offset function
    By Lukael in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-15-2014, 09:51 AM
  4. Excel Offset Function Dynamic Range Question
    By d247 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 01-13-2014, 03:43 PM
  5. Replies: 4
    Last Post: 06-12-2012, 04:13 PM

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