+ Reply to Thread
Results 1 to 11 of 11

Last 5 occurrences.

  1. #1
    Forum Contributor
    Join Date
    03-06-2020
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    113

    Last 5 occurrences.

    Need a formula to calculate last 5 occurances. Expected output in columns f and g . Input in E2
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    Office2010/office 365
    Posts
    1,065

    Re: Last 5 occurrences.

    Hi,
    In F2 and drag to the right and down:
    =INDEX(B$1:B$13,AGGREGATE(14,6,(ROW($C$2:$C$13)*($E$2=$A$2:$A$13)),ROWS(I$1:$J1)))

  3. #3
    Registered User
    Join Date
    08-15-2020
    Location
    malaysia
    MS-Off Ver
    office2007
    Posts
    345

    Re: Last 5 occurrences.

    Formula F2 and E2
    Attached Files Attached Files

  4. #4
    Forum Expert boopathiraja's Avatar
    Join Date
    07-12-2013
    Location
    Coimbatore,TamilNadu, India
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    1,449

    Re: Last 5 occurrences.

    If you are using excel 2007, you can adopt the below cse formula

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


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



    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    Click just below left if it helps, Boo■athý

  5. #5
    Registered User
    Join Date
    08-15-2020
    Location
    malaysia
    MS-Off Ver
    office2007
    Posts
    345

    Re: Last 5 occurrences.

    F2 cell array formula , Drag down and accross

    HTML Code: 
    =IFERROR(INDEX(B:B,SMALL(IF($A$2:$A$50=$E$2,ROW($2:$50),4^8),6-ROW(1:1))),"")

  6. #6
    Forum Contributor
    Join Date
    03-06-2020
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    113

    Re: Last 5 occurrences.

    Only works for A and not for others and if i add more data to it it doesnt take that into consideration.

  7. #7
    Valued Forum Contributor
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    Office2010/office 365
    Posts
    1,065

    Re: Last 5 occurrences.

    According to your example - it is only for A
    If not - please post a representative file with versatile cases

  8. #8
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    2010
    Posts
    2,213

    Re: Last 5 occurrences.

    And in the sample it is the last 5 values but the dates appear reversed! Which way round do you want them displayed?

  9. #9
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    1,886

    Re: Last 5 occurrences.

    Excel 2016 (Windows) 32 bit
    E
    F
    G
    2
    B
    17/10/2020
    - 55
    3
    02/10/2020
    5


    E
    F
    G
    2
    B
    =IFERROR(INDEX($B$1:$B$100,LARGE(IF($A$2:$A$100=$E$2,ROW($A$2:$A$100),"#N/A"),ROW()-1)),"")
    =IFERROR(INDEX($C$1:$C$100,LARGE(IF($A$2:$A$100=$E$2,ROW($A$2:$A$100),"#N/A"),ROW()-1)),"")
    3
    =IFERROR(INDEX($B$1:$B$100,LARGE(IF($A$2:$A$100=$E$2,ROW($A$2:$A$100),"#N/A"),ROW()-1)),"")
    =IFERROR(INDEX($C$1:$C$100,LARGE(IF($A$2:$A$100=$E$2,ROW($A$2:$A$100),"#N/A"),ROW()-1)),"")
    Attached Files Attached Files
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  10. #10
    Forum Expert JosÚ Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,314

    Re: Last 5 occurrences.

    Or try with a helper column

    In H2 and drag down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    In F2 use the following formula and drag down and across
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    See the file
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    03-06-2020
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    113

    Re: Last 5 occurrences.

    Thank you all. Got it

+ 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] making all occurrences of a value match the change made in one of those occurrences
    By GAZZYMAN in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 03-23-2017, 10:51 PM
  2. Counting Occurrences
    By RiaanDeysel in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-28-2015, 11:52 AM
  3. [SOLVED] Count occurrences of a value
    By bigband1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-29-2015, 06:57 AM
  4. Multiple occurrences
    By nesthead98 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-02-2009, 04:30 PM
  5. sort 2 or more occurrences
    By akullen in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-09-2006, 10:45 PM
  6. [SOLVED] COUNTIF:many occurrences
    By cestbarb in forum Excel General
    Replies: 10
    Last Post: 03-31-2006, 04:20 AM
  7. [SOLVED] # of occurrences
    By gbeard in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-05-2005, 05:06 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