+ Reply to Thread
Results 1 to 4 of 4

loop to avergae out colums numbers.

  1. #1
    Forum Contributor
    Join Date
    04-16-2016
    Location
    bognor
    MS-Off Ver
    Pro-Plus 2016
    Posts
    153

    loop to avergae out colums numbers.

    Hi all
    another tricky one here
    lets say I have ten sheets in my workbook and in column E of these sheets I have a series of numbers.The number of cells occupied will vary from sheet to sheet.
    I am looking to find the average of each column of numbers,then place this average in sheet 11 in the relevent cell.ie average from sheet 1 will go into A1 in sheet 11,average from sheet 2 will go into A2 in sheet 11 and so on.
    The problem is a bit tricky because the number of cells occupied in the colE of each sheet will vary
    This can be done manually with the average function in autosum(creating a macro) but the problem here is that because the number of cells on each sheet varies and the"average" figure gets placed down in the last cell of the sheet(1048576!)
    Is there a way this could be done in vb.either with or without a loop.
    1)open sheet 1
    2)read to the last cell
    3)average out the cells in the column
    4)place the figure in sheet 11
    5)then go onto next sheet an so on
    any help much appreciated.
    Kind Regards
    bif

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,678

    Re: loop to avergae out colums numbers.

    Hi, as result is to be placed in separate sheet you can use just
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    in A1 Sheet11 and similar formulas in A2 etc.
    of course it can be done with a loop in VBA something like (not tested):
    Please Login or Register  to view this content.
    Last edited by Kaper; 08-28-2018 at 05:31 AM.
    Best Regards,

    Kaper

  3. #3
    Forum Contributor
    Join Date
    04-16-2016
    Location
    bognor
    MS-Off Ver
    Pro-Plus 2016
    Posts
    153

    Re: loop to avergae out colums numbers.

    Hi Kaper,
    Thankyou for the code and advice(and quick response).The code works brilliantly,and the formula will also come in very useful.

    many thanks
    kind regards
    BIF

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,678

    Re: loop to avergae out colums numbers.

    Glad it worked, and thanks for nice words :-)

+ 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. How to loop thru two colums the best way
    By KalleKL in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 12-01-2016, 02:20 PM
  2. loop through a colums changing values conditionally
    By tangerinedream in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-22-2014, 01:16 PM
  3. How to make an avergae of a SUM IF formula
    By pansovic in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-30-2011, 07:27 PM
  4. Excel 2007 : Fill Numbers between two colums
    By sailesh9630 in forum Excel General
    Replies: 10
    Last Post: 06-21-2011, 07:43 AM
  5. matching numbers across colums
    By lostinacolumn in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-04-2009, 12:45 PM
  6. Find avergae between cells.
    By RockyStrong in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-24-2008, 02:53 PM
  7. problem in avergae formula
    By naughtyboy in forum Excel General
    Replies: 1
    Last Post: 09-20-2006, 04:22 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