+ Reply to Thread
Results 1 to 16 of 16

Average amount of latest 4 values based on criteria

  1. #1
    Registered User
    Join Date
    06-01-2011
    Location
    karachi, pakistan
    MS-Off Ver
    Excel 2007
    Posts
    7

    Average amount of latest 4 values based on criteria

    I have 2 excel sheets. Sheet 1 have following records:

    Salon coach date amount
    Sal1 col1 11/7/2018 500
    Sal1 col1 11/1/2018 400
    Sal1 col1 10/25/2018 600
    Sal1 col1 10/19/2018 700
    Sal1 col1 10/1/2018 250
    And so on
    Sheet 2 have following cloumns and records:

    Salon coach average of lastest 4 dates
    Sal1 col1 ???
    I want to find average amount for 4 latest dates with match the criteria salon and coach. Thanks in advance.
    Last edited by goodguyrulz; 11-07-2018 at 07:31 PM.

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Average amount of latest 4 values based on criteria

    Hi goodyguyrulz. Welcome to the forum.

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




    A
    B
    C
    D
    E
    F
    G
    H
    1
    Salon
    coach
    date
    amount
    Salon
    coach
    average
    2
    Sal1
    col1
    11/7/2018
    500
    Sal1
    col1
    550
    3
    Sal1
    col1
    11/1/2018
    400
    4
    Sal1
    col1
    10/25/2018
    600
    5
    Sal1
    col1
    10/19/2018
    700
    6
    Sal1
    col1
    10/1/2018
    250
    Dave

  3. #3
    Registered User
    Join Date
    06-01-2011
    Location
    karachi, pakistan
    MS-Off Ver
    Excel 2007
    Posts
    7
    FlameRetired,

    Thank you for the message, already tried this works if we have one salon and one coach. If new salon comes it doesnt show correct values
    Last edited by jeffreybrown; 11-08-2018 at 11:10 AM. Reason: Please do not quote full posts. We can see the information in the post above.

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Average amount of latest 4 values based on criteria

    Then we need an upload of a spreadsheet that is representative of the real issues. Something that includes a representative set of what you are working with and a section (hand typed if necessary) showing the layout of the desired outputs.

    If you are not familiar with how to do this know that the 'paperclip' icon has not worked for a long time. Instead:

    To attach a file to your post: (Please no pics or screenshots ... saves retyping data.),

    be sure to desensitize the data
    • click “Go Advanced” (next to Post Quick Reply – bottom right),
    • scroll down until you see “Manage Attachments”, click that,
    • click “Browse”.
    • select your file(s)
    • click “Upload”
    • click “Close window”
    • click “Submit Reply”
    The file name will appear at the bottom of your reply.

  5. #5
    Registered User
    Join Date
    06-01-2011
    Location
    karachi, pakistan
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Average amount of latest 4 values based on criteria

    Hi,
    I have attached the file. Please see the detail i want to calculate average of 4 latest dates excluding the most recent date.
    Attached Files Attached Files

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,853

    Re: Average amount of latest 4 values based on criteria

    You appear to have shifted the goalposts - is it the 4 latest dates or the 4 latest dates excluding the latest, and if the latter, does this mean the average of 3 or 4 dates? What you have failed to do is provide the answers you are expecting, manually calculated.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  7. #7
    Registered User
    Join Date
    06-01-2011
    Location
    karachi, pakistan
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Average amount of latest 4 values based on criteria

    I am really sorry for the confusion. these are 4 latest dates excluding the most latest date and this means average of 4 dates. lets suppose we have 5 dates it needs to calculate average of 4 dates starting with 2nd most recent date to 5th date.
    Last edited by AliGW; 11-09-2018 at 04:26 AM.

  8. #8
    Registered User
    Join Date
    06-01-2011
    Location
    karachi, pakistan
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Average amount of latest 4 values based on criteria

    updated file with expected output is attached.
    Attached Files Attached Files
    Last edited by AliGW; 11-09-2018 at 04:26 AM.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,853

    Re: Average amount of latest 4 values based on criteria

    Thanks for the clarification.

    Please don't quote whole posts, especially when you are responding to the one immediately preceding your own - it's just clutter. It's OK to quote if you are responding to a post out of sequence, but limit quoted content to a few relevant lines that makes clear to whom and what you are responding. Thanks!

    For normal conversational replies, try using the QUICK REPLY box below.

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Average amount of latest 4 values based on criteria

    Still a bit confused, but this gives your expected result. Check it carefully, as your sample numbers may not highlight errors...

    =AVERAGE(IF((Table1[Salon]=F3)*(Table1[coach]=G3)*ROW(Table1[amount])>=LARGE((Table1[Salon]=F3)*(Table1[coach]=G3)*ROW(Table1[amount]),MIN(4,COUNTIFS(Table1[Salon],F3,Table1[coach],G3))),Table1[amount],""))

    This is an array formula. Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Average amount of latest 4 values based on criteria

    No. I think that it is wrong. Please update your sample with DIFFERENT numbers of rows for each combination (currently they are all n=5) along with the manually calculated expected answer

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Average amount of latest 4 values based on criteria

    This will work... provided that the dates within each group combination are ALWAYS in descending order. If not, please supply a REALISTIC and REPRESENTATIVE sample.

    There's bound to be a better way to do this.... but I'm not seeing it yet!! BtW, it will still work if there are fewer than 4 valid values to average.

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


    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Attached Files Attached Files

  13. #13
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Average amount of latest 4 values based on criteria

    Irrespective of order in date formula gives the average required.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  14. #14
    Registered User
    Join Date
    06-01-2011
    Location
    karachi, pakistan
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Average amount of latest 4 values based on criteria

    Thanks Kvsrinvasamurthy

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,853

    Re: Average amount of latest 4 values based on criteria

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  16. #16
    Registered User
    Join Date
    06-01-2011
    Location
    karachi, pakistan
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Average amount of latest 4 values based on criteria

    Thanks Glenn Kennedy.

+ 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. Latest Date Based on Multiple Criteria
    By amycat81178 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-01-2018, 05:01 PM
  2. Need Latest Date Based on Criteria Help
    By amycat81178 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-25-2018, 01:19 PM
  3. How Do I find the latest report based on a criteria?
    By sdelariva in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-06-2018, 11:06 AM
  4. How Do I find the latest report based on a criteria?
    By sdelariva in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-06-2018, 09:37 AM
  5. [SOLVED] Return total amount values based on multiple criteria
    By MyStix01 in forum Excel General
    Replies: 3
    Last Post: 10-12-2017, 09:05 AM
  6. [SOLVED] Return amount values based on date and name criteria
    By MyStix01 in forum Excel General
    Replies: 2
    Last Post: 10-09-2017, 09:26 PM
  7. Return Latest Date Based on a Criteria
    By skate1991 in forum Excel General
    Replies: 3
    Last Post: 09-09-2015, 04:51 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