+ Reply to Thread
Results 1 to 16 of 16

Use COUNTIF and RIGHT in one formula

  1. #1
    Registered User
    Join Date
    09-24-2014
    Location
    Auckland, New zealand
    MS-Off Ver
    2013
    Posts
    50

    Use COUNTIF and RIGHT in one formula

    Hi, I have a plain text column of numbers all with four digits to the right of the decimal point. I want to count every cell in the column where those four digits are not 0000
    I tried this but failed:
    =countif(C1:C500,right(C1:C500,4)<>"0000")
    Can anyone help please?
    Thank you, Chris

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

    Re: Use COUNTIF and RIGHT in one formula

    I think we need to see whats REALLY in those cells... are they formatted to look like 4 dps, etc.

    Refere to the yellow banner (top) and post a small sample Excel file.
    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

  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,194

    Re: Use COUNTIF and RIGHT in one formula

    On reflection, try this:

    =SUMPRODUCT(--(C1:C500=INT(C1:C500)))

  4. #4
    Registered User
    Join Date
    09-24-2014
    Location
    Auckland, New zealand
    MS-Off Ver
    2013
    Posts
    50

    Re: Use COUNTIF and RIGHT in one formula

    13.0830
    13.1100
    14.0900
    14.0950
    15.0000
    15.0000
    15.0000
    16.0000
    16.0000
    16.0000
    17.0615
    17.1120
    17.1808

    Thanks Glenn. I will try it
    Chris

  5. #5
    Registered User
    Join Date
    09-24-2014
    Location
    Auckland, New zealand
    MS-Off Ver
    2013
    Posts
    50

    Re: Use COUNTIF and RIGHT in one formula

    In the example above there are 7 cells that don't end in .0000

  6. #6
    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,194

    Re: Use COUNTIF and RIGHT in one formula

    Do try it, with your real data... as I'd asked for an Excel sheet, not a copy/paste job.

  7. #7
    Registered User
    Join Date
    09-24-2014
    Location
    Auckland, New zealand
    MS-Off Ver
    2013
    Posts
    50

    Re: Use COUNTIF and RIGHT in one formula

    I want to count cells that don't end in 0000, not add them together.

  8. #8
    Registered User
    Join Date
    09-24-2014
    Location
    Auckland, New zealand
    MS-Off Ver
    2013
    Posts
    50

    Re: Use COUNTIF and RIGHT in one formula

    Thanks Glenn, if you need sheet, let me figure out how to supply one from my phone here. I did try your formula though and got a #value error

  9. #9
    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,194

    Re: Use COUNTIF and RIGHT in one formula

    The formula does NOT sum them. It counts them.

    Did you TRY it???

    See file.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    09-24-2014
    Location
    Auckland, New zealand
    MS-Off Ver
    2013
    Posts
    50

    Re: Use COUNTIF and RIGHT in one formula

    Yes I tried it but got the value error. I think the issue may be as I said, it's plain text format done to cause the following zeros to display rather than hide them.

  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,194

    Re: Use COUNTIF and RIGHT in one formula

    So, please do as I asked at Post #2 and post an EXCEL sheet. I need to see what is REALLY in those cells.

  12. #12
    Registered User
    Join Date
    09-24-2014
    Location
    Auckland, New zealand
    MS-Off Ver
    2013
    Posts
    50

    Re: Use COUNTIF and RIGHT in one formula

    Thank you I will do so when I am back on my laptop on Monday. I can't do it from my phone.

  13. #13
    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,194

    Re: Use COUNTIF and RIGHT in one formula

    OK. No problem!

  14. #14
    Registered User
    Join Date
    09-24-2014
    Location
    Auckland, New zealand
    MS-Off Ver
    2013
    Posts
    50

    Re: Use COUNTIF and RIGHT in one formula

    Hi Glenn,

    I have uploaded a sheet for you. Thanks

    Chris
    Attached Files Attached Files

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

    Re: Use COUNTIF and RIGHT in one formula

    Try this:

    =SUMPRODUCT(--(--SUBSTITUTE(C1:C80,"-","")=INT(--SUBSTITUTE(C1:C80,"-",""))))
    Attached Files Attached Files
    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.

  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
    44,194

    Re: Use COUNTIF and RIGHT in one formula

    Well, that is a TOTALLY different problem. When did you tell us about the hyphen and the remaining digits in the cell.

    Alis works, of course

    An alternative would be
    =SUMPRODUCT(--((--LEFT(C1:C80,7))<>(--LEFT(C1:C80,2))))

    for NOT EQUAL to, and

    =SUMPRODUCT(--((--LEFT(C1:C80,7))=(--LEFT(C1:C80,2))))

    for EQUAL to.

    Hiwever, can entries like this occur:

    12.0000-1630 where the first numeric substring ends in 0000 ? Then Ali's formula & mine give different results. Which is correct, I do not know, as you did not specify that condition.
    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] Help with countif formula for calendar (countif any date in table present)
    By KMJ256388 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-25-2021, 12:11 PM
  2. [SOLVED] formula to identify the unique code after filtration using countif or other formula
    By felixpanganiban in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-27-2019, 01:25 PM
  3. [SOLVED] COUNTIF formula where part of the range reference needs to use the result of a formula
    By zookeepertx in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 11-09-2018, 05:39 PM
  4. Adding a COUNTIF function to an existing IF AND COUNTIF Formula...
    By Ourkid123uk in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-24-2018, 10:09 AM
  5. Faster if/countif formula for flagging uniques - countif too slow
    By Speshul in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-19-2015, 01:44 PM
  6. [SOLVED] =Subtotal(countif,Range); Subtotal and countif in 1 formula [SOLVED]
    By thomas.mapua in forum Excel General
    Replies: 5
    Last Post: 01-06-2012, 11:33 AM
  7. Adding a CountIF to a formula that is already Countif
    By Cmorgan in forum Excel General
    Replies: 4
    Last Post: 06-01-2011, 09:34 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