+ Reply to Thread
Results 1 to 11 of 11

Find Average in a dynamic column

  1. #1
    Registered User
    Join Date
    01-28-2013
    Location
    London, England
    MS-Off Ver
    Office 365 for Mac
    Posts
    17

    Find Average in a dynamic column

    Hi to everyone on the Forum,

    I have used this service in the past with great results but I had not written any VBA work for a couple of years and am a bit rusty so if anyone can help!

    I need to get the average of a dynamic column of data in Column J beginning at J12 with the answer placed in J5. Each row of data in the column is monetary, formatted as Accounting. There will not be any blank cells or zero values.

    Help is appreciated.

    Peter

  2. #2
    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
    47,997

    Re: Find Average in a dynamic column

    Why do you need VBA?
    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


  3. #3
    Registered User
    Join Date
    01-28-2013
    Location
    London, England
    MS-Off Ver
    Office 365 for Mac
    Posts
    17

    Re: Find Average in a dynamic column

    Hi TMS

    can I do the same with just a formula?

    I have been using VBA for all the actions within the worksheet but if there is a formula which can do the same job that is great. Of course the main criteria is that as the data is added the formula captures it.

    Regards

  4. #4
    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
    47,997

    Re: Find Average in a dynamic column

    One way:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-28-2013
    Location
    London, England
    MS-Off Ver
    Office 365 for Mac
    Posts
    17

    Re: Find Average in a dynamic column

    Hi TMS
    Thanks for the formula it worked when I changed it to Average rather than Sum. It does seem to work in the same way as the Average Function i.e. =Average(J12:1000) Is this code different and can it be used in VBA with the ActiveCell.Formula code?
    Peter

  6. #6
    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
    47,997

    Re: Find Average in a dynamic column

    Sorry, should have been AVERAGE rather than SUM

    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Find Average in a dynamic column

    if you want VBA, this will work for you:

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    01-28-2013
    Location
    London, England
    MS-Off Ver
    Office 365 for Mac
    Posts
    17

    Re: Find Average in a dynamic column

    Thanks TMS that worked for me.

    dmcgov Thanks for your code, I tried that too but got a runtime error "subscript out of range" when the line "Set ws = wb.Sheets("Dynamic")" was reached.

  9. #9
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Find Average in a dynamic column

    yup, my bad. change the work "Dynamic" to whatever your sheet name is

  10. #10
    Registered User
    Join Date
    01-28-2013
    Location
    London, England
    MS-Off Ver
    Office 365 for Mac
    Posts
    17

    Re: Find Average in a dynamic column

    dmcgov

    Thanks, thought it might be something like that but I changed the workbook to worksheets.

  11. #11
    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
    47,997

    Re: Find Average in a dynamic column

    You're welcome. Thanks for the rep.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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. Moving average on dynamic named range without helper column
    By HemAt in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-31-2016, 12:15 PM
  2. Average a column, exlcude a row in a dynamic pivot table
    By MSHyperion in forum Excel General
    Replies: 5
    Last Post: 04-18-2014, 07:41 PM
  3. 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
  4. [SOLVED] Find Average, Return Column Header of Number Closest To Average
    By djmyers in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 07-07-2013, 04:19 PM
  5. [SOLVED] Find average of column b based on boundaries applied to column a
    By Kybynn in forum Excel General
    Replies: 1
    Last Post: 12-04-2012, 07:17 AM
  6. Replies: 10
    Last Post: 11-21-2011, 12:51 PM
  7. Replies: 14
    Last Post: 04-02-2010, 02:22 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