+ Reply to Thread
Results 1 to 12 of 12

Count only cells with specific formula element

  1. #1
    Registered User
    Join Date
    08-08-2019
    Location
    Virginia, United States
    MS-Off Ver
    15.32 Mac
    Posts
    6

    Count only cells with specific formula element

    Hi!

    I'm working on an analysis of a frequency distribution that is based on sums of unique combinations of numbers, and I want to find out how many cells have a specific number in the calculation. For example: If I have two cells, one of which is =1+2+3+4+5, and another cell that is =2+4+6+8+10, then the count for 2 as an element is '2', while the count for 1 as an element is '1' (10 is a different element from 1). Which formula should I use to give me this count automatically? I've tried using the COUNT function, Pivot Tables and vlookups, but these only seem to count the entire cell's display, not elements within a calculation.

    Thanks!
    Catherine

  2. #2
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Count only cells with specific formula element

    maybe you should't use =2+4+6+8+10?

  3. #3
    Registered User
    Join Date
    08-08-2019
    Location
    Virginia, United States
    MS-Off Ver
    15.32 Mac
    Posts
    6

    Re: Count only cells with specific formula element

    That is not helpful. What would you recommend that I use instead?

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

    Re: Count only cells with specific formula element

    You will need to provide some sample data with expected outcomes, please.
    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.

  5. #5
    Registered User
    Join Date
    08-08-2019
    Location
    Virginia, United States
    MS-Off Ver
    15.32 Mac
    Posts
    6

    Re: Count only cells with specific formula element

    This is what I'm trying to do:

    1) Build a frequency distribution of all sums possible when choosing and adding 5 numbers drawn from a set of 1 - 10, without replacement (e.g. 1+2+3+4+5 = 15, where '15' is displayed in the cell).
    2) Find out how many of these sums (e.g. 15 from #1) are calculated using a specific number from the set (e.g. 4).
    3) Ideally, be able to adjust #2 so that I can focus on sums within a specific range (e.g. between 20 & 30), and how many of those are built using a specific number (e.g. 4).

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

    Re: Count only cells with specific formula element

    I don't think it's at all necessary for these elements to be in the same cell from what you have said, however some sample data mocked up to show what you are aiming for (a few rows of results data with the source data) will help us to advise you.

  7. #7
    Registered User
    Join Date
    08-08-2019
    Location
    Virginia, United States
    MS-Off Ver
    15.32 Mac
    Posts
    6

    Re: Count only cells with specific formula element

    Here is a sample distribution, where each cell in the spreadsheet would display the sum (listed in the first row as value = #):
    Value = 6 Value = 7 Value = 8 Value = 9 Value = 10 Value = 11 Value = 12
    =1+2+3 =1+2+4 =1+2+5 =1+3+5 =1+4+5 =2+4+5 =3+4+5
    =1+3+4 =2+3+4 =2+3+5

    Here is what I am trying to build from that data, using only the calculations that give values from 7 to 9:
    # sums using 1 4
    # sums using 2 3
    # sums using 3 3
    # sums using 4 3
    # sums using 5 2

    Is there a way to do this automatically, without having to manually count each and every cell that includes a specific number in the summation?

  8. #8
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Count only cells with specific formula element

    is there VBA in mac?
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    08-08-2019
    Location
    Virginia, United States
    MS-Off Ver
    15.32 Mac
    Posts
    6

    Re: Count only cells with specific formula element

    Yes, there is a VB editor in the Mac Excel, but I've never used it. How does it work?

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

    Re: Count only cells with specific formula element

    Hello CMPeterson and Welcome to Excel Forum.
    Here is a formula based proposal that takes a bit of manipulating the formulas from which the count is taken:
    1. I pasted the formulas from post #7 into rows 1:3
    2. On the Formulas tab I selected Show Formulas
    3. I utilized the Replace feature to replace = with '=
    4. I deselected Show Formulas
    5. I typed the digits 1:9 into A5:A13
    6. I placed the following formula into cell B5 and copied down: =SUMPRODUCT(--ISNUMBER(SEARCH(TEXT(A5,"0"),Sheet1!A$2:G$3)))
    For future reference you will usually get faster results if you upload a workbook that displays your query by clicking on the GO ADVANCED button below the Quick Reply window and then scrolling down to Manage Attachments to open the upload window.
    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.

  11. #11
    Registered User
    Join Date
    08-08-2019
    Location
    Virginia, United States
    MS-Off Ver
    15.32 Mac
    Posts
    6

    Re: Count only cells with specific formula element

    Thanks! I think I see how to adjust that formula to make it more versatile, in the context I need, but it at least gives me a starting point.

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

    Re: Count only cells with specific formula element

    You're Welcome and thank you for the feedback. Please take a moment to mark the thread as 'Solved' using the thread tools menu above your first post. I hope that you have a blessed day.

+ 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 if previous element doesnīt have specific value
    By Ataps in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-19-2018, 02:16 PM
  2. Countif Formula to count specific cells (Help Please)
    By sultan5533 in forum Excel General
    Replies: 5
    Last Post: 07-25-2017, 09:57 AM
  3. A formula to count cells with a specific color?
    By Harlort in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-21-2014, 08:55 AM
  4. Need formula to count specific number of cells
    By FairfaxHS in forum Excel General
    Replies: 2
    Last Post: 05-18-2012, 04:10 PM
  5. Excel formula to count cells with specific text
    By timtrace in forum Excel General
    Replies: 3
    Last Post: 04-06-2011, 12:32 AM
  6. formula to count cells containing #'s in a specific range
    By woogiebooboo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-27-2006, 03:30 PM
  7. [SOLVED] Need formula to count specific cells in a row
    By JanetP in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-28-2005, 10:06 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