+ Reply to Thread
Results 1 to 7 of 7

Average if last 3 entries skiping the final entry and excluding blanks

  1. #1
    Registered User
    Join Date
    08-15-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Post Average if last 3 entries skiping the final entry and excluding blanks

    Hello:
    I am brand new to the forum and would greatly appreciate your assistance.

    For a data contained in a row (e.g. A2..Z2), I need to calculate the average of the previous 3 entries excluding any blank cells, but including 0 (zeros).

    Thank you!

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Average if last 3 entries skiping the final entry and excluding blanks

    Hi and welcome to the forum

    A regular =AVERAGE() will include zero's but ignore blank cells in the range
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    08-15-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Average if last 3 entries skiping the final entry and excluding blanks

    Thanks for your response.

    Much like a moving average, I need the formula to skip the last entry and average the next 3 entries (cells that contain numbers) it finds while skipping any blank cells. Am I expaining it a little better?

  4. #4
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Average if last 3 entries skiping the final entry and excluding blanks

    welcome to the forum, HAEG. it's always clearer when you upload a sample excel file & follow my guidelines here:
    http://www.excelforum.com/tips-and-t...d-answers.html
    my guess is you can use this array formula:
    =AVERAGE(IF(COLUMN(A2:Z2)=LARGE(IF(A2:Z2<>"",COLUMN(A2:Z2)),{1;2;3}),A2:Z2))
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you might get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    if you want to skip the last entry, change {1;2;3} to {2;3;4}

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  5. #5
    Registered User
    Join Date
    08-15-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Average if last 3 entries skiping the final entry and excluding blanks

    Thank you, benishiryo!
    I retested, and the formula does work. However, It did not work if there were less than 3 entries in the row. How do I adjust the formula to correct those errors?

  6. #6
    Registered User
    Join Date
    08-15-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Average of last 3 or less entries skipping the final entry and excluding blanks

    Can anyone else help with the last part of this formula? What if I have less than 3 entries in the row?
    Much like a moving average, I need the formula to skip the last entry in the row and average the next 3 or (less) entries (i.e. cells that contain numbers) it finds while skipping any blank cells.

    array formula:
    =AVERAGE(IF(COLUMN(A2:Z2)=LARGE(IF(A2:Z2<>"",COLUMN(A2:Z2)),{1;2;3}),A2:Z2))
    if you want to skip the last entry, change {1;2;3} to {2;3;4}

  7. #7
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Average if last 3 entries skiping the final entry and excluding blanks

    you're welcome. here's 1 way:
    =IFERROR(AVERAGE(IF(COLUMN(A2:Z2)=LARGE(IF(A2:Z2<>"",COLUMN(A2:Z2)),{1;2;3}),A2:Z2)),AVERAGEIF(A2:Z2,"<>"))

+ 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. [SOLVED] MIN value excluding blanks
    By coach.32 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-19-2013, 04:52 PM
  2. 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
  3. Vlookup/lookup lastest entry excluding blanks
    By dominion in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-21-2012, 03:12 AM
  4. [SOLVED] Count IF excluding blanks or zeroes
    By Ash in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-02-2006, 07:45 PM
  5. [SOLVED] Average of an array of entries, minus the lowest entry
    By ingersollg in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-26-2005, 05:15 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