+ Reply to Thread
Results 1 to 16 of 16

Unable to dynamically count last 10 cells of column

  1. #1
    Registered User
    Join Date
    11-04-2022
    Location
    Chicago, IL
    MS-Off Ver
    MS365 Version 2202
    Posts
    7

    Unable to dynamically count last 10 cells of column

    Hello!

    My goal is to be able to automatically count the last 10 cells in a column. So far I have this:

    =(COUNTIF(INDEX(AB$18:AB$182,ROWS(AB$18:AB$57)-9):INDEX(AB$18:AB$182,ROWS(AB$18:AB$57)), ">=" &J2)/10)

    This returns the percentage of cells in the last 10 cells of a column that are greater than or equal to cell J2.

    My issue is that this excel sheet changes extremely frequently and I would like to streamline this process by eliminating the need to change where the last row is (in this case it's 57). How can I modify this formula to recognize a change in the size of the column and automatically adjust to the location of the new 10 last values?

    Is there something I can do with =IF(ISBLANK()) potentially?

    Any help is greatly appreciated!

    (Workbook is attached! Formula is located in cell N2).
    Attached Files Attached Files
    Last edited by przemek1414; 11-04-2022 at 11:54 AM.

  2. #2
    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,460

    Re: Unable to dynamically count last 10 cells of column

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook. Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.

    Administrative Note:

    Is your forum profile showing the version of Excel that you need this to work for? 2202 is a release number ...

    Members will tailor the solutions they offer to the version of Office (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your version is for Mac, please also state this.

    The three most recent versions of Excel are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the release number in your profile (e.g. MS365 Version 2211). This is in the About Excel section further down the Account page.

    Thanks.
    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.

  3. #3
    Registered User
    Join Date
    11-04-2022
    Location
    Chicago, IL
    MS-Off Ver
    MS365 Version 2202
    Posts
    7

    Re: Unable to dynamically count last 10 cells of column

    Thank you for the tips! Changes are applied

  4. #4
    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
    43,986

    Re: Unable to dynamically count last 10 cells of column

    Try:
    =SUMPRODUCT(--(INDEX(B:B,AGGREGATE(14,6,ROW($B$2:$B$1000)/($B$2:$B$1000<>""),1)-SEQUENCE(10,,0))>=J2))
    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

  5. #5
    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
    43,986

    Re: Unable to dynamically count last 10 cells of column

    But... with 2211, this simplifies to:

    =LET(r,B2:B1000,f,TAKE(FILTER(r,r<>""),-10),ROWS(FILTER(f,f>=J2)))
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    11-04-2022
    Location
    Chicago, IL
    MS-Off Ver
    MS365 Version 2202
    Posts
    7

    Re: Unable to dynamically count last 10 cells of column

    This did it! Thank you!

    Are you able to explain some of the logic behind this please (the first formula, not the 2211 version)? I am not an excel expert by any means.

  7. #7
    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
    43,986

    Re: Unable to dynamically count last 10 cells of column

    =LET(r,B2:B1000,f,TAKE(FILTER(r,r<>""),-10),ROWS(FILTER(f,f>=J2)))

    red: defines the range (r)
    green: filter r, returning only values where r is non-blank
    Cyan defines f, the last 10 values in the range
    purple filters f, returning only the rows >= J2
    black returns the number of rows in f.


    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

  8. #8
    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
    43,986

    Re: Unable to dynamically count last 10 cells of column

    The Outer =LET() just allows the intermediate steps to be held and resuded as needed... to make the formula much shorter.

  9. #9
    Registered User
    Join Date
    11-04-2022
    Location
    Chicago, IL
    MS-Off Ver
    MS365 Version 2202
    Posts
    7

    Re: Unable to dynamically count last 10 cells of column

    I'm sorry, I meant the first formula you posted. I only have ver. 2202.

    The second will be good to know once we upgrade!

  10. #10
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,410

    Re: Unable to dynamically count last 10 cells of column

    This solution works for users EXCEL 365 from version V2203
    In post #13 is a solution for all users EXCEL 365.

    Please try for calculation "%save bet hit in L10" in N2 and copy down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Make sure that the values in A2:A10 match the headings of the table.
    Attached Files Attached Files
    Last edited by HansDouwe; 11-04-2022 at 01:17 PM.

  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
    43,986

    Re: Unable to dynamically count last 10 cells of column

    Your profile said 2211 a few minutes ago!! Didn't it??

  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
    43,986

    Re: Unable to dynamically count last 10 cells of column

    =SUMPRODUCT(--(INDEX(B:B,AGGREGATE(14,6,ROW($B$2:$B$1000)/($B$2:$B$1000<>""),1)-SEQUENCE(10,,0))>=J2))
    Red: find the highest row number that is non blank
    Cyan: count back 10 rows, including the highest row
    Green - return the values in those rows
    Black add up the values that exceed J2.

    (And divide by 10, format as % if desired...)

  13. #13
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,410

    Re: Unable to dynamically count last 10 cells of column

    Here is an alternative solution for all users Excel 365 and all users Excel 2021

    This formula also automatically selects the required column

    Please try in N2 and copy down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Make sure that the values in A2:A10 match the headings of the table.
    This formula does not need to be adjusted per row.
    Attached Files Attached Files
    Last edited by HansDouwe; 11-04-2022 at 01:40 PM.

  14. #14
    Registered User
    Join Date
    11-04-2022
    Location
    Chicago, IL
    MS-Off Ver
    MS365 Version 2202
    Posts
    7

    Re: Unable to dynamically count last 10 cells of column

    It did, I changed it because I made a mistake Thank you so much for your help! This was incredibly helpful.

  15. #15
    Registered User
    Join Date
    11-04-2022
    Location
    Chicago, IL
    MS-Off Ver
    MS365 Version 2202
    Posts
    7

    Re: Unable to dynamically count last 10 cells of column

    Thank you! This worked phenomenally as well! I really need to study up on this.

  16. #16
    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
    43,986

    Re: Unable to dynamically count last 10 cells of column

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

+ 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] Dynamically average first 4 non blank cells in a column
    By Kooksmagooks in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-30-2021, 08:52 PM
  2. Unable to =Count() Cells that were once Merged
    By JoshDR in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-27-2015, 03:34 PM
  3. Unable to change column width after protecting cells
    By rex99 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-07-2013, 12:25 PM
  4. Replies: 5
    Last Post: 02-04-2013, 05:32 PM
  5. Replies: 3
    Last Post: 11-08-2012, 07:25 PM
  6. Macro that will dynamically cut and insert entire rows after column cells are updated
    By excelryan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-10-2012, 09:59 AM
  7. [SOLVED] Unable to count values in one column matching criteria from another
    By Gijs in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-28-2011, 08:39 AM

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