+ Reply to Thread
Results 1 to 3 of 3

VBA function: Find Average within Dynamic Range

  1. #1
    Registered User
    Join Date
    05-26-2020
    Location
    Odense, Denmark
    MS-Off Ver
    2020 - 365
    Posts
    31

    Smile VBA function: Find Average within Dynamic Range

    Hi Forum.

    I would like to add a custom VBA function to find an average of a range which is defined as follows:
    • The selected range is the lower and upper bound for the function
    • Within the selected range it should find the first column that is visible (no hidden columns should be taken into account)
    • In the function you should add how many rows you want to add into the new Range start. If it exceeds the upper bound defined in the selected range then use upper bound.


    I've attached a picture with an example of how i would like the function to behave.

    How do i solve that?

    Thank you in advance.

    3Ce43Zz.png
    Last edited by Ralleberg; 02-04-2022 at 06:57 AM.

  2. #2
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: VBA function: Find Average within Dynamic Range

    Here's the function. However, there's no way we can get the formula to auto-refresh when a column is hidden or unhidden. You would have to recalculate the sheet by pressing Shift + F9 or from the 'Formulas' tab.

    Please Login or Register  to view this content.
    Happy to Help

    How to upload excel workbooks at this forum - http://www.excelforum.com/the-water-...his-forum.html

    "I don't get things easily, so please be precise and elaborate"

    If someone's post has helped you, thank by clicking on "Add Reputation" below the post.
    If your query is resolved please mark the thread as "Solved" from the "Thread Tools" above.

    Sourabh

  3. #3
    Registered User
    Join Date
    05-26-2020
    Location
    Odense, Denmark
    MS-Off Ver
    2020 - 365
    Posts
    31

    Re: VBA function: Find Average within Dynamic Range

    Quote Originally Posted by sourabhg98 View Post
    Here's the function. However, there's no way we can get the formula to auto-refresh when a column is hidden or unhidden. You would have to recalculate the sheet by pressing Shift + F9 or from the 'Formulas' tab.

    Please Login or Register  to view this content.
    Wow sourabhg98 that was simply it. Thank you so much! Even though is not refreshing after a column is hidden this works perfectly and would save a lot of time.
    Rep yor way.

+ 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. Replies: 4
    Last Post: 10-01-2021, 06:06 AM
  2. Average of Dynamic Range
    By RV1458 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 4
    Last Post: 03-05-2021, 04:58 PM
  3. Find Average in a dynamic column
    By peter wischhusen in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-27-2019, 02:40 PM
  4. [SOLVED] Correct syntax for function to find average based on background color of cells in range
    By moosetales in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-21-2014, 12:24 AM
  5. VBA: Find the average of a column with a dynamic range
    By surePac in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2014, 03:47 PM
  6. [SOLVED] Dynamic Average Function
    By compd1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-05-2013, 01:30 AM
  7. Dynamic range based on find function
    By ChrisNor in forum Excel General
    Replies: 7
    Last Post: 04-16-2009, 09:38 AM

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