+ Reply to Thread
Results 1 to 2 of 2

Dynamic Range and Average Formula

  1. #1
    Registered User
    Join Date
    02-25-2014
    Location
    Milan, Italy
    MS-Off Ver
    Excel 2003
    Posts
    1

    Dynamic Range and Average Formula

    Hi guys,
    I'm a newbie in VBA and I can't solve the problem below, can you please help me?
    Here a brief description:
    in Column A, there's a series of numeric data, from A1 to A31;
    in cell C1 I can insert the number that expresses the lenght of the average I'd like to calculate;
    in cell C16 the result of the average.
    So, the lenght of the average depends on cell C1. The average is a centered average, the maximum range goes from A1 to A31 (if I put 31 in C1. If I put, for example, 5, the range goes from A14 to A18).
    Thank you for your help.
    Ciao

    Marco from Italy

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Dynamic Range and Average Formula

    Try this. Its a function placed in a module that you can use as a formula. Book1.xlsm
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Dynamic Range and Average Formula

    Hi Molfetta and welcome to the forum,

    See if this code makes sense to you.

    Please Login or Register  to view this content.
    You will need to run this code using Solus Rankin's worksheet above. I think Solus gave you the average of the top and this code uses the middle.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

+ 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. Dynamic Range average
    By rjhe22 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-12-2013, 03:42 PM
  2. Average over a dynamic range of values in a different worksheet
    By MummyB in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-30-2012, 10:41 AM
  3. [SOLVED] Average of last 3 cells in a range, dynamic
    By Armitage2k in forum Excel General
    Replies: 11
    Last Post: 03-25-2012, 02:48 PM
  4. Excel 2007 : Dynamic range/average issue?
    By gannon_w in forum Excel General
    Replies: 5
    Last Post: 02-26-2012, 10:42 PM
  5. Dynamic range in average formula
    By Cicada in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-09-2011, 02:08 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