+ Reply to Thread
Results 1 to 33 of 33

How to count just numbers in the second column which are not the same

  1. #1
    Registered User
    Join Date
    02-05-2021
    Location
    Slovakia
    MS-Off Ver
    2006
    Posts
    14

    How to count just numbers in the second column which are not the same

    Snímka.PNG

    Hello there,
    I used this function:
    =COUNTIFS(A1:A5;A1;B1:B5;"<>")

    I have table with 2 columns (A,B) and 5 rows. At the first column are the same dates and at the second column are different numbers but some of them are the same. According to the function result is 5 (sum of all dates). How to count just numbers in the second column which are not the same? Thank you!
    Last edited by AliGW; 02-05-2021 at 09:20 AM.

  2. #2
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,788

    Re: Countifs

    Post a small Excel sheet (not a picture) showing realistic & representative sample data WITHOUT confidential information (10-20 rows, not thousands...) and some manually calculated results. Just before posting, scroll down to GO ADVANCED, click, and then scroll down to MANAGE ATTACHMENTS and click again. Now follow the instructions at the top of that screen.

  3. #3
    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,406

    Re: How to count just numbers in the second column which are not the same

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however the thread title does not really convey what your request is about. Tell us what you are trying to do, not how you think it should be done.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. As you are new, I have done it for you this time.)
    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.

  4. #4
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,788

    Re: How to count just numbers in the second column which are not the same

    D1=SUM(IF(FREQUENCY(IF(B1:B100<>"",MATCH(A1:A100&B1:B100,A1:A100&B1:B100,0)),ROW(B1:B100)-ROW(B1)+1),1))

    Control+shift+enter

  5. #5
    Registered User
    Join Date
    02-05-2021
    Location
    Slovakia
    MS-Off Ver
    2006
    Posts
    14

    Re: Countifs

    Hello, Ive done it, thank you

    I think I need to use function COUNTIFS because according to my sheet, at first I need to pick the same dates and then I need to pick the numbers which are not the same in the second column. Simply I need the result as 1 number which says how many times are numbers in particular date without repeating numbers.
    Attached Files Attached Files
    Last edited by zuzwha; 02-05-2021 at 09:56 AM.

  6. #6
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,788

    Re: How to count just numbers in the second column which are not the same

    H4=SUM(IF(FREQUENCY(IF($B$3:$B$50=G2,MATCH(B3:B50&C3:C50,B3:B50&C3:C50,0)),ROW(B3:B50)-ROW(B3)+1),1))


    Control+shift+enter


    There are duplicates in the first attached file

    in the second no
    Last edited by CARACALLA; 02-05-2021 at 10:08 AM.

  7. #7
    Registered User
    Join Date
    02-05-2021
    Location
    Slovakia
    MS-Off Ver
    2006
    Posts
    14

    Re: How to count just numbers in the second column which are not the same

    Thank you very much for your effort but it's not working. To be honest I really dont understand to your function I just put it into cell and then I can see a message with error with this function.
    Maybe I make some mistakes with copying and pasting but I think there is a problem with match function. But Im not sure. I would show you this error message but it is in Slovak
    Maybe it would help if you send me excel document with completed result and I could download it. Thank you very much
    Last edited by zuzwha; 02-05-2021 at 01:57 PM.

  8. #8
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,788

    Re: How to count just numbers in the second column which are not the same

    After you type in the formula, don't just press enter.
    Instead, press CTRL + SHIFT + ENTER

    If you've already entered the formula, then highlight the cell with the formula and press F2.
    Then press CTRL + SHIFT + ENTER


    When entered correctly, the formula will be enclosed in {brackets}

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

    Re: How to count just numbers in the second column which are not the same

    It is NOT that simple.


    Firstly, your date column is a mixture of real dates and text fragments that look a bit like a date. NOW, they are all dates. This formula returns the count you need.

    =SUM(INDEX(($B$3:$B$50=G2)/COUNTIFS($C$3:$C$50,$C$3:$C$50&"",$B$3:$B$50,$B$3:$B$50&""),0))

    I have filtered the data. You can see the duplicates (in pink). My formula is returning a count of the unique numbers, whereas yours is returning a count of them all.

    this is a regular formula (just use Enter). In beautiful Slovakia you might need to use ; instead of ,
    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

  10. #10
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,788

    Re: How to count just numbers in the second column which are not the same

    Attached file

    There are no duplicates in your file for 1.12.

    My formula works
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    02-05-2021
    Location
    Slovakia
    MS-Off Ver
    2006
    Posts
    14

    Re: How to count just numbers in the second column which are not the same

    Oh yes sorry the data have to be filtered, thank you for all but Glenn your answer helped me so much. I think I can apply it in my tables, thank you again
    I added reputation to CARACALLA as well
    Last edited by zuzwha; 02-05-2021 at 02:43 PM.

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

    Re: How to count just numbers in the second column which are not the same

    Now you tell us that they meed to be filtered!!

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

    Re: How to count just numbers in the second column which are not the same

    So use this array formula:

    =SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET($B$3,ROW($C$3:$C$50)-MIN(ROW($C$3:$C$50)),)),IF($B$3:$B$50=G2,MATCH($C$3:$C$50,$C$3:$C$50,0))),ROW($C$3:$C$50)-MIN(ROW($C$3:$C$50))+1),1))

    The file shows it working on a filtered list.


    Array formuale 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 the curly brackets { } 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

  14. #14
    Registered User
    Join Date
    02-05-2021
    Location
    Slovakia
    MS-Off Ver
    2006
    Posts
    14

    Re: How to count just numbers in the second column which are not the same

    Sorry again, when I put my sheet into this forum, I forgot to edit dates to one format, then it can be filtered. Thank you for explanation. Just one last question:
    When I want to use this array formula:

    =SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET($B$3,ROW($C$3:$C$50)-MIN(ROW($C$3:$C$50)),)),IF($B$3:$B$50=G2,MATCH($C$3:$C$50,$C$3:$C$50,0))),ROW($C$3:$C$50)-MIN(ROW($C$3:$C$50))+1),1))

    to another table which is longer or for example starts on cell A, I have to rewrite this formula or it is possible to edit it automatically? Maybe it is stupid question, but Im beginner in functions of excel. Thank you to all of you.

  15. #15
    Registered User
    Join Date
    02-05-2021
    Location
    Slovakia
    MS-Off Ver
    2006
    Posts
    14

    Re: How to count just numbers in the second column which are not the same

    Could you help me please?

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

    Re: How to count just numbers in the second column which are not the same

    Provide an updated sample workbook demonstrating the issue.

  17. #17
    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,135

    Re: How to count just numbers in the second column which are not the same

    Well you do have to ensure that the ranges are correct. So, IF the data begins on row 5 and runs to 100... and with the formula in an Excel cell

    =SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET($B$3,ROW($C$3:$C$50)-MIN(ROW($C$3:$C$50)),)),IF($B$5:$B$100=G2,MATCH($C$3:$C$50,$C$3:$C$50,0))),ROW($C$3:$C$50)-MIN(ROW($C$3:$C$50))+1),1))

    FIRST change the bits in red. Enter.

    Then change ONE of the column C ranges

    =SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET($B$5,ROW($C$5:$C$100)-MIN(ROW($C$3:$C$50)),)),IF($B$5:$B$100=G2,MATCH($C$3:$C$50,$C$3:$C$50,0))),ROW($C$3:$C$50)-MIN(ROW($C$3:$C$50))+1),1))

    Enter.

    Then double click on that part of the formula which you just changed, Excel will select $C$5:$C$100.

    CTRL-C.

    double click on the next $C$3:$C$50 bit of the formula. CTRL-V.

    Repeat as needed.

    CTRL-SHIFT-ENTER.

    Done.

  18. #18
    Registered User
    Join Date
    02-05-2021
    Location
    Slovakia
    MS-Off Ver
    2006
    Posts
    14

    Re: How to count just numbers in the second column which are not the same

    Thank you so much! I believe you it's the quickest way. I think it's definetely solved.
    Last edited by zuzwha; 02-07-2021 at 08:38 AM.

  19. #19
    Registered User
    Join Date
    02-05-2021
    Location
    Slovakia
    MS-Off Ver
    2006
    Posts
    14

    Re: How to count just numbers in the second column which are not the same

    Hello Glenn, Im in a company and Im watching your Attached File. But when I choose filtered 4.12.2020, there is result 3, but the same numbers 5021 are just 2, so result should be 2 not 3

  20. #20
    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,135

    Re: How to count just numbers in the second column which are not the same

    There are 3 UNIQUE numbers in the filtered list. Do you want a count of those that occur only ONCE on a FILTERED list?

  21. #21
    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,135

    Re: How to count just numbers in the second column which are not the same

    If that is what you want, use this:

    =SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET($B$3,ROW($C$3:$C$50)-ROW($C$3),)),IF($B$3:$B$50=G2,MATCH($C$3:$C$50,$C$3:$C$50,0))),ROW($C$3:$C$50)-ROW($C$3)+1)=1,1))


    Adjust the ranges to whatever you need, and don't forget it's an array formula.
    Attached Files Attached Files

  22. #22
    Registered User
    Join Date
    02-05-2021
    Location
    Slovakia
    MS-Off Ver
    2006
    Posts
    14

    Re: How to count just numbers in the second column which are not the same

    yes it works now, but when I rewrite number 5034 to 5021 on the filtered dates 4.12.2020, there 3 unique numbers 5021, but result is 1 and should be 3

  23. #23
    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,135

    Re: How to count just numbers in the second column which are not the same

    I think we are not undertanding each other here. You have not explained the criteria.

    For EACH of these scenarios, what is the expected answer (filtered list) and WHY:

    5021
    5021
    5021
    5021


    5021
    5021
    5021
    5044

    5021
    5021
    5044
    5044


    5021
    5022
    5023
    5023

    5021
    5022
    5023
    5024

    I do not know what you want to count... values that occur once, total unique count, values that occur twice.... we are playing giuessing games. I do not play guessing games. So please define what you want CLEARLY.

  24. #24
    Registered User
    Join Date
    02-05-2021
    Location
    Slovakia
    MS-Off Ver
    2006
    Posts
    14

    Re: How to count just numbers in the second column which are not the same

    Sorry my English is not so good and I didnt understand clearly what my colleague wants because he doesnt know English, Im trying to explain it clearly so:
    your first attached file is correct, result is 3 which is correct, but when I choose or filter dates 29.12.2020 according to your first sheet(MySheet) result is 0 and should be 2 because there is 2 different numbers without repeating numbers.

    So according to your last post,
    first column should be 1 (all columns according to date)
    second column should be 2
    third column should be 2
    fourth column should be 3
    fifth column should be 4

    In the end he wants to sum or count all results to one number. He doesnt need these numbers, just result or sum of all these results (1,2,2,3,4)
    I really appreciate your effort

  25. #25
    Registered User
    Join Date
    02-05-2021
    Location
    Slovakia
    MS-Off Ver
    2006
    Posts
    14

    Re: How to count just numbers in the second column which are not the same

    Could anyone to help me please? It's enough(How to count just numbers in the second column which are not the same) for my colleauge. To sum or count the result numbers he can use a pen and a paper.
    I really want to help him.
    The attached file below is working just for the filtered dates 4.12.2020 (result 3,(cell K2)) but for example for the dates 29.12.2020 is not working (result is 0 and should be 2).
    Does exist anyone who could edit the attached file? Thank you in advance.
    Attached Files Attached Files

  26. #26
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,919

    Re: How to count just numbers in the second column which are not the same

    Hi,

    Try this formula in cell G2:

    =INDEX(B3:B50,MATCH(1,SUBTOTAL(3,OFFSET($B$3,ROW($C$3:$C$50)-MIN(ROW($C$3:$C$50)),0,1,1)),0))

    Enter with Ctrl+Shift+Enter.
    Attached Files Attached Files

  27. #27
    Registered User
    Join Date
    02-05-2021
    Location
    Slovakia
    MS-Off Ver
    2006
    Posts
    14

    Re: How to count just numbers in the second column which are not the same

    No sorry Phuocam, it is not working. Im interested just in first 2 columns. I dont want to filter according to Prod. Because when I choose or filter in your sheet the dates 4.12.2020 without filtering Proud, the result is 6 which is wrong. Columns Prod. and Oprava can be deleted

  28. #28
    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,135

    Re: How to count just numbers in the second column which are not the same

    My file, which you reattached at post 25 works perfectly. You have maybe forgotten that you enter the date in G2. That's they way it has worked RIGHT from the start. Your first post was referring to G2, so I continued doing the same.

  29. #29
    Registered User
    Join Date
    02-05-2021
    Location
    Slovakia
    MS-Off Ver
    2006
    Posts
    14

    Re: How to count just numbers in the second column which are not the same

    Okay friend Glenn, maybe Im stupid or I dont know but Ive downloaded your file again now. When I filter the dates 29.12.2020 there is result in cell K2 = 0 and should be 2. Right? Guys I really appreciate your patience with me and your effort!!!

    Capture.PNG
    Last edited by zuzwha; 02-09-2021 at 10:05 AM.

  30. #30
    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,135

    Re: How to count just numbers in the second column which are not the same

    What did I say about G2 in my last post. Enter the date in G2.... If you can remember back to the start, everything hinged on what was in G2.... That was YOUR requirement at the time!!

  31. #31
    Registered User
    Join Date
    02-05-2021
    Location
    Slovakia
    MS-Off Ver
    2006
    Posts
    14

    Re: How to count just numbers in the second column which are not the same

    yes you are right, I rewrited the date in cell G2 and it works, maybe you or me mentioned it before but I didnt understand, thank you very much for your file and clear explanation for me.

  32. #32
    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,406

    Re: How to count just numbers in the second column which are not the same

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

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  33. #33
    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,135

    Re: How to count just numbers in the second column which are not the same

    That's the problem with lengthy threads... sometimes the original objectives get lost and misunderstood!

+ 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] Countifs+Countifs only when certain criteria met
    By coach.32 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-05-2019, 08:34 AM
  2. Replies: 6
    Last Post: 03-19-2019, 09:14 PM
  3. [SOLVED] Sumproduct to replace countifs as countifs don't work on external source reference
    By KrishnaSagar in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-02-2017, 02:33 AM
  4. How can I run CountIfs + CountIfs without double counting?
    By hiitsjessie in forum Excel General
    Replies: 1
    Last Post: 02-06-2017, 04:49 PM
  5. [SOLVED] Countifs + Countifs - replacement?
    By JulieQ in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-05-2015, 03:02 PM
  6. COUNTIFS OR...multiple countifs without duplication in the numbers
    By HooligaD in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-21-2012, 09:53 AM
  7. Replies: 0
    Last Post: 12-16-2011, 09:01 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