+ Reply to Thread
Results 1 to 11 of 11

How to count numbers in a column based on a set of numbers

  1. #1
    Registered User
    Join Date
    11-09-2022
    Location
    Ghana
    MS-Off Ver
    2021
    Posts
    6

    How to count numbers in a column based on a set of numbers

    I have a set of numbers (2,4,0) and (5,17,10). Column F outputs true if the subsequent numbers in column A belong to the same set of numbers. Column G returns numbers in column B if cells in F are true. Column Q counts the values in the G based on the numbers in P. Their percentages are calculated using the formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    I want to calculate the percentage based on the set of numbers mentioned above. Therefore I need a formula that can count values in G on condition that cells in column F are TRUE and if numbers in column A are in same set. The expected output is in column S and T however these should output one at a time. So in my example, because 5 which the last number in column A that belongs to one set, I would like to see 50% and 50% only. if the last number in column A was 0, i would see just 33.33%,33.33% and33.33% only. I wouldn't want them in separate columns . This was asked in Mr.Excel but no response.
    Thanks
    Attached Files Attached Files
    Last edited by dwyane; 11-09-2022 at 04:29 PM.

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

    Re: How to count numbers in a column based on a set of numbers

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not told us about this. You are required to do so.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important: https://excelguru.ca/a-message-to-forum-cross-posters/

    (Note: this requirement is not optional. As you are new here, I shall do it for you this time: https://www.mrexcel.com/board/thread...mbers.1221613/)
    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-09-2022
    Location
    Ghana
    MS-Off Ver
    2021
    Posts
    6

    Re: How to count numbers in a column based on a set of numbers

    Thank you for the correction as I am new here, I wasn't aware of that rule. I hadn't receive an answer that's why I came here. I would not repeat that again. Thanks
    Last edited by dwyane; 11-09-2022 at 06:40 AM.

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

    Re: How to count numbers in a column based on a set of numbers

    However, you did tick to say that you had read and understood our rules when you joined today ...

    Have a read of them now, please.

  5. #5
    Registered User
    Join Date
    11-09-2022
    Location
    Ghana
    MS-Off Ver
    2021
    Posts
    6

    Re: How to count numbers in a column based on a set of numbers

    Yes please I have

  6. #6
    Registered User
    Join Date
    11-09-2022
    Location
    Ghana
    MS-Off Ver
    2021
    Posts
    6

    Re: How to count numbers in a column based on a set of numbers

    Couldm't add link to original post because I am new here. Does it mean my question will not receive answers?

  7. #7
    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,800

    Re: How to count numbers in a column based on a set of numbers

    Please read post #2 carefully: in it, I explained that I would provide the link for you this time. This I did. There is NO instruction that prevents anyone from responding.

    Please be patient.

  8. #8
    Registered User
    Join Date
    11-09-2022
    Location
    Ghana
    MS-Off Ver
    2021
    Posts
    6

    Re: How to count numbers in a column based on a set of numbers

    Ok. Thank you

  9. #9
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: How to count numbers in a column based on a set of numbers

    I don't understand what "I wouldn't want them in separate columns" means, so if the results are not where you want them, please attach another file that will illustrate that part of the request.
    The following formulas replicate the values seen in columns S:T
    For column S: =SUMPRODUCT(((A$1:A$20=2)+(A$1:A$20=4)+(A$1:A$20=0))*(A$1:A$20<>"")*(G$1:G$20=P4))/SUMPRODUCT(((A$1:A$20=2)+(A$1:A$20=4)+(A$1:A$20=0))*(A$1:A$20<>"")*(G$1:G$20<>""))
    For column T: =SUMPRODUCT(((A$1:A$20=5)+(A$1:A$20=17)+(A$1:A$20=10))*(A$1:A$20<>"")*(G$1:G$20=P4))/SUMPRODUCT(((A$1:A$20=5)+(A$1:A$20=17)+(A$1:A$20=10))*(A$1:A$20<>"")*(G$1:G$20<>""))
    Note that both columns are custom formatted using: 0.00%;;
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  10. #10
    Registered User
    Join Date
    11-09-2022
    Location
    Ghana
    MS-Off Ver
    2021
    Posts
    6

    Re: How to count numbers in a column based on a set of numbers

    Hello,
    What I meant i dont want them in separate columns is that the percentages should show in only column S on condition of the last number in column A. Therefore if the last number is say zero in column A then only percentages for that group should show in column S

  11. #11
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: How to count numbers in a column based on a set of numbers

    Looking at the file attached to post #1, and according to the information in post #10, should cells S5 and S7 display 50%?

+ 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. Replies: 2
    Last Post: 04-01-2022, 04:22 PM
  2. Replies: 8
    Last Post: 03-13-2022, 04:16 PM
  3. [SOLVED] Count number of cells that contain numbers based on another column
    By DarrenCl in forum Excel General
    Replies: 11
    Last Post: 09-08-2016, 07:22 AM
  4. Replies: 3
    Last Post: 08-01-2016, 10:31 AM
  5. Count number of clusters of numbers within a column of numbers
    By SEABOND in forum Hello..Introduce yourself
    Replies: 3
    Last Post: 08-01-2016, 09:34 AM
  6. Replies: 8
    Last Post: 03-03-2014, 06:53 AM
  7. [SOLVED] Count repeat numbers in column B based on a condition from Column Al
    By helpbitte in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-24-2012, 10:11 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