+ Reply to Thread
Results 1 to 6 of 6

Get average excluding the last value.

  1. #1
    Registered User
    Join Date
    04-08-2014
    Location
    München, Deutschland
    MS-Off Ver
    Excel 2013
    Posts
    7

    Get average excluding the last value.

    Dear all,

    I have a question about average within VBA code.

    I need to get the average of values as follow:

    A1 : 2
    A2: 4
    A3 : 8
    A4 : 3

    I would like to get the average from A1 to A3 excluding the last value in A4.

    Tomorrow, I'll add a value in A5 so I would need the average range to dynamically adjust to A1:A4, excludign A5.


    I use
    Please Login or Register  to view this content.
    It is probably an easy one, but I am fairly new to VBA,
    Thanks for your time,
    -Thomas

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Get average excluding the last value.

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-08-2014
    Location
    München, Deutschland
    MS-Off Ver
    Excel 2013
    Posts
    7

    Re: Get average excluding the last value.

    Thanks john.

    is end(3)(0) = end(xlup) ?

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Get average excluding the last value.

    You're welcome. Glad to help out.

    (3) = (xlUp)
    (0) = an offset command for one row above the last cell in the column with data.

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Get average excluding the last value.

    If you're satisfied then don't forget to comply with Forum Rule No. 9.

    9. Acknowledge the responses you receive, good or bad. If your problem is solved, please say so clearly, and mark your thread as Solved: Click Thread Tools above your first post, select "Mark your thread as Solved". Or click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Dropdown option or Edit button will not appear -- ask a moderator to mark it.

  6. #6
    Registered User
    Join Date
    04-08-2014
    Location
    München, Deutschland
    MS-Off Ver
    Excel 2013
    Posts
    7

    Re: Get average excluding the last value.

    I'll do it straight away. Thanks again for your help.

+ 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. Average() excluding zero's
    By HPIMICHAEL02 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-10-2013, 02:58 AM
  2. [SOLVED] Average of cells excluding #DIV/0!
    By AZNDrumsKazuki in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-30-2013, 05:04 PM
  3. The rank of average ranks excluding empty cells but including their average.
    By Terminal45 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-21-2012, 03:44 AM
  4. Average excluding DIV/0
    By olga6542 in forum Excel General
    Replies: 1
    Last Post: 06-14-2010, 03:24 PM
  5. [SOLVED] AVERAGE excluding #N/A
    By RonB in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-02-2005, 05:06 PM

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