+ Reply to Thread
Results 1 to 6 of 6

How to count rows based on cell value?

  1. #1
    Forum Contributor
    Join Date
    09-19-2016
    Location
    Alaska
    MS-Off Ver
    MS 2010, 2013, 2016
    Posts
    272

    How to count rows based on cell value?

    Hello everyone, I have a formula in column "I"
    Please Login or Register  to view this content.
    that works but now I need to make changes to it.

    I want the same idea applied except if the value on column "H" is not CBA, then count up to the value in M4. If the value = CBA then count up to the value in M6. I did try on column "J"
    Please Login or Register  to view this content.
    but that did not return what I want (see column K for what formula should return). Any ideas on other ways I can approach or fix this?
    Attached Files Attached Files
    Last edited by AccountingJ; 02-09-2021 at 11:42 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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,418

    Re: How to count rows based on cell value?

    Try this:

    =IF(AND(H2="ABC",COUNTIF(H$2:H2,H2)>$M$4),"",IF(AND(H2="CBA",COUNTIF(H$2:H2,H2)>$M$6),"",COUNTIF(H$2:H2,H2)))
    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
    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,137

    Re: How to count rows based on cell value?

    I knew I'd overcomplicated it... a bit!!!!

    =IFERROR(1/(1/(IF(H2="ABC",IF(COUNTIF(H$2:H2,"ABC")>$M$4,"",COUNTIF(H$2:H2,"ABC")),0)+IF(H2="CBA",IF(COUNTIF(H$2:H2,"CBA")>$M$6,0,COUNTIF(H$2:H2,"CBA")),0))),"")

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

  4. #4
    Forum Contributor
    Join Date
    09-19-2016
    Location
    Alaska
    MS-Off Ver
    MS 2010, 2013, 2016
    Posts
    272

    Re: How to count rows based on cell value?

    Thank you Ali and Glenn, both formulas worked. I appreciate the time you took, I see what I was missing.

    Also, that's funny Glenn, we all tend to do that from time to time.

  5. #5
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,418

    Re: How to count rows based on cell value?

    It's usually the other way round - Glenn cuts to the change whilst I'm flapping around trying to get to the crux of the matter!!!

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,213

    Re: How to count rows based on cell value?

    Another one at L2

    =IFERROR(--TEXT(COUNTIFS(H$2:H2,H2),"[<="&IF(H2="ABC",M$4,M$6)&"]0;"),"")
    Attached Files Attached Files

+ 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] How to count rows based in numerical order based on cell values?
    By AccountingJ in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-02-2019, 04:59 PM
  2. [SOLVED] How to count rows based in numerical order based on cell values?
    By AccountingJ in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-14-2019, 10:54 PM
  3. [SOLVED] How to count rows based on cell value.
    By AccountingJ in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-03-2019, 09:09 AM
  4. Insert rows based on the count in another cell
    By Shareez Saleem in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-11-2017, 05:59 AM
  5. Insert rows based on the count in another cell
    By Shareez Saleem in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-11-2017, 04:02 AM
  6. [SOLVED] Count Rows Based On User Input & Trigger Print Of Pages Out Of Count Result
    By wliang in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-09-2012, 02:45 AM
  7. Insert Rows Based on Cell Count
    By PY_ in forum Excel General
    Replies: 2
    Last Post: 10-29-2010, 10:52 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