+ Reply to Thread
Results 1 to 15 of 15

Count? number of different groups of values in a column

  1. #1
    Registered User
    Join Date
    01-03-2024
    Location
    Norfolk, UK
    MS-Off Ver
    MS Prof Plus 2019 Windows 11 Pro MSO 16.0
    Posts
    23

    Count? number of different groups of values in a column

    Hi, I'm not sure if it is the Count function I need/can use or pivot tables or what for my quandary.

    I need to count down columns (51 site columns in total) for every day of the year, of how many of each number group occurs for what number of days. I have attached a small example - Column Site1 has 4 days with 8 stock and 15 days with 7 stock and so on for all columns. So the result I need is basically just that, to tell me that for the whole of Site1 for the year, it had 8 stock for 4 days and 7 stock for 15 days - I don't need to know which days of in what order.

    Is there a super duper formula or function that can do this for me please? At the moment I am simply having to select/drag down each number group and record the count shown at the bottom right of the Excel screen for ever column! (365 days for 51 sites with numerous number groups) Highly time consuming and tedious as you can imagine.

    Thank you,
    kind regards
    Lee
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,041

    Re: Count? number of different groups of values in a column

    Where are the expected results? I don't see any. Please mock them up.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    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 2406
    Posts
    44,662

    Re: Count? number of different groups of values in a column

    You gave no indication of the format you wanted... so as a guess (see file)

    =COUNTIF(B:B,$I2)

    copied across and down.
    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

  4. #4
    Registered User
    Join Date
    01-03-2024
    Location
    Norfolk, UK
    MS-Off Ver
    MS Prof Plus 2019 Windows 11 Pro MSO 16.0
    Posts
    23

    Re: Count? number of different groups of values in a column

    Thanks for the replies.
    Glen I think your idea may work, it looks like I would need to set up another table like yours, below mine to be able to insert 365 rows worth to enable the calculations to work.
    I have to go now but will come back to this tomorrow morning.
    See you then hopefully. Thank you

  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 2406
    Posts
    44,662

    Re: Count? number of different groups of values in a column

    or...

    =IFERROR(INDEX(B:B,AGGREGATE(15,6,ROW(B$3:B$21)/((B$3:B$21<>0)*(COUNTIF(J$2:J2,B$3:B$21)=0)),1)),"")

    copied across and dnown. But still a guess, as we do not have any idea of what YOU expect to see.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-03-2024
    Location
    Norfolk, UK
    MS-Off Ver
    MS Prof Plus 2019 Windows 11 Pro MSO 16.0
    Posts
    23

    Re: Count? number of different groups of values in a column

    Sorry for the delay, it's been a crazy busy day.
    Thanks Glen. Your 2nd idea unfortunately does not give me the info I need eg it just tells me there were 8 stock but not for how many days.
    Your first suggestion with COUNTIF does give the correct result but I would need to extend your Stock column to at least 130 to allow for the large numbers of stock that we can get. If there is no other way then your suggestion will still be better me counting manually.
    After the comments you both left about how I want the result formatted, I realise it would be quite tricky, if not impossible to get the correct result any better than what you have suggested but I thought Excel could do anything ;-)

    Thank you.

  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 2406
    Posts
    44,662

    Re: Count? number of different groups of values in a column

    Well. you could always actually SHOW me how you WOULD like the data formatted. So far, you haven't done that.

    However, if you're OK with what you have already...


    You're welcome. Thanks for letting us know that you got an answer.




    Please take a moment and consider clicking the "Add Reputation" button at the foot of any of the posts of anyone who helped you reach a solution here today.

    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
    Registered User
    Join Date
    01-03-2024
    Location
    Norfolk, UK
    MS-Off Ver
    MS Prof Plus 2019 Windows 11 Pro MSO 16.0
    Posts
    23

    Re: Count? number of different groups of values in a column

    That's because I don't know how either!! :-) I don't mind what way just as long as it tells me
    Site 1: 8 stock for 4 days; 7 stock for 15 days and so on

  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 2406
    Posts
    44,662

    Re: Count? number of different groups of values in a column

    Maybe this, then??
    Attached Files Attached Files

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Count? number of different groups of values in a column

    or... set up a Named Range (Rng - CTRL-F3 to viewe edit):

    =INDEX(Sheet1!$B$3:$F$21,,1+INT((COLUMNS(Sheet1!$A2:A2)-1)/2))

    and use this, copied across and down (keep column I blank!!):

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

  11. #11
    Registered User
    Join Date
    01-03-2024
    Location
    Norfolk, UK
    MS-Off Ver
    MS Prof Plus 2019 Windows 11 Pro MSO 16.0
    Posts
    23

    Re: Count? number of different groups of values in a column

    Good morning Glenn, Thank you very much for your generous help. I had gone home by the time I saw your last message/suggestion and my brain was frazzled!
    Anyway, I have been looking at both your options. You must have a PHd in Excel because your formula is amazing! I am not advanced in Excel so I don't understand it that much but that's ok.
    Anyway, an issue in using your sheet is that when I've been in one of your formulated cells and click in the formula bar to see what cells are highlighted, then i click out of the cell, all your data disappears and I can't get it back! Any ideas on why this is happening? I'm not sure i am going to be able to transfer your super formula to my original sheet.

  12. #12
    Registered User
    Join Date
    01-03-2024
    Location
    Norfolk, UK
    MS-Off Ver
    MS Prof Plus 2019 Windows 11 Pro MSO 16.0
    Posts
    23

    Re: Count? number of different groups of values in a column

    I've just noticed that the squiggly brackets {} (can't recall the name of those!) at the beginning of your formulas disappear when I click in the formulated cells. Should these {} still be part of the formula or do they appear when copying a formula type of thing?!!

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,041

    Re: Count? number of different groups of values in a column

    You need to enter the forumula with CTRL+SHIFT+ENTER, not just ENTER.

    In Excel 2021 and 365, this is no longer necessary, but it is in 2019.

  14. #14
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Count? number of different groups of values in a column

    it is >>possible<<, indeed probable, that you will need (as Ali said) to use CTRL-SHIFT-ENTER to enter the formula as an array formula before dragging across/down.

    No Excel PhD... but a PhD in Biochemistry and a DSc in veterinary analytical chemistry!!

  15. #15
    Registered User
    Join Date
    01-03-2024
    Location
    Norfolk, UK
    MS-Off Ver
    MS Prof Plus 2019 Windows 11 Pro MSO 16.0
    Posts
    23

    Re: Count? number of different groups of values in a column

    Thanks Ali & Glenn. I think I know what you mean. However, same thing is happening. So, after reopening your document Glenn so the data was there, I clicked in a formulated cell and clicked in the formula bar then did Ctrl+Shift+Enter but the same thing happens, all data disappears. I don't understand.
    I think this is way beyond my capabilities so I think if I can't get it to work from here then so be it but I thank you for your kind help. I don't want to take anymore of your time.
    Glenn you're clearly very clever person - I didn't know veterinary analytical chemistry was in even out there!!
    Best wishes.

+ 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. Count number a column of values passes a certain number
    By bjcowen9000 in forum Excel General
    Replies: 1
    Last Post: 01-24-2020, 01:44 AM
  2. [SOLVED] Count groups of consecutive values in a column
    By TFiske in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-03-2016, 02:12 PM
  3. [SOLVED] Count number of unique values in Column A that match a term in Column B
    By frsaxon in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-29-2016, 07:22 AM
  4. Replies: 12
    Last Post: 01-16-2016, 10:13 AM
  5. Replies: 4
    Last Post: 10-09-2015, 05:19 AM
  6. [SOLVED] trying to count the number of groups of like data in a column
    By Rob69mfj in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-24-2014, 04:03 PM
  7. Replies: 4
    Last Post: 07-16-2013, 09:45 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