+ Reply to Thread
Results 1 to 19 of 19

Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

  1. #1
    Registered User
    Join Date
    11-21-2018
    Location
    St. George, UT
    MS-Off Ver
    Excel 2015
    Posts
    10

    Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

    Hi all,

    I am working a spreadsheet for my job. I want to count the number of cells in a given area that contain hard entered numbers <=50, however within the same range are cells that sum up a column of data. I want to be able to exclude those cells from the formula without having to split the range. There are multiple sheets in the same workbook and the location of the calculating cells changes in each so to change the split range would be kind of a pain.

    I've tried a wide range COUNTIF and COUNTIFS and they still count the cells that contain the =SUM() formulas. They either include them in the count or return 0. I tried a SUMPRODUCT formula, but I don't understand the dynamics enough to get it to do what I want.

    Essentially I want it to do the following:

    =COUNTIF(rng,"<=50") but NOT cells that contain =SUM()

    Thanks!
    Last edited by peculiar101; 11-21-2018 at 06:11 PM.

  2. #2
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

    Try this array formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-21-2018
    Location
    St. George, UT
    MS-Off Ver
    Excel 2015
    Posts
    10

    Re: Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

    =SUMPRODUCT((F6:I12>=50)*(IFERROR(LEFT(FORMULATEXT(F6:I12),4)="=SUM",0)))

    It returns 0, it should be 4 if It's counting correctly.

  4. #4
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

    Have you entered the formula with CTRL+Shift+Enter ?

    To enter a array formula you must confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

  5. #5
    Registered User
    Join Date
    11-21-2018
    Location
    St. George, UT
    MS-Off Ver
    Excel 2015
    Posts
    10

    Re: Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

    Yes, okay, that worked BUT it returned 3 instead of 4....
    Attached Images Attached Images
    Last edited by peculiar101; 11-21-2018 at 01:57 PM.

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

    Hi,

    I believe there's an =ISFORMULA() function in Excel 2016 and later.
    If you want a UDF then here's one I made earlier

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


    In the worksheet use

    =COUNTFORMULAS(your_range)

    See attached example
    Attached Files Attached Files
    Last edited by Richard Buttrey; 11-21-2018 at 02:00 PM.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  7. #7
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

    Quote Originally Posted by peculiar101 View Post
    Yes, okay, that worked BUT it returned 3 instead of 4....
    Can you show me the four values?

  8. #8
    Registered User
    Join Date
    11-21-2018
    Location
    St. George, UT
    MS-Off Ver
    Excel 2015
    Posts
    10

    Re: Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

    The four highlighted cells contain the =SUM() formula calculating the sums of the two rows below them. I want the formula to just count the cells where I've entered 36.
    Attached Images Attached Images

  9. #9
    Registered User
    Join Date
    11-21-2018
    Location
    St. George, UT
    MS-Off Ver
    Excel 2015
    Posts
    10

    Re: Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

    Quote Originally Posted by Richard Buttrey View Post

    =COUNTFORMULAS(your_range)

    See attached example
    This would work for counting the formulas, but I want to count the cells with numbers and exclude the ones with formulas...

  10. #10
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

    One other way
    1. Select your range
    2 Hit the F5 Goto key and choose Special
    3 Select Formulas & OK

    You'll see the Count of the formula in the bar at the bottom

  11. #11
    Registered User
    Join Date
    11-21-2018
    Location
    St. George, UT
    MS-Off Ver
    Excel 2015
    Posts
    10

    Re: Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

    Quote Originally Posted by Richard Buttrey View Post
    You'll see the Count of the formula in the bar at the bottom
    Thanks, but I don't want to count the formulas...

  12. #12
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

    My mistake
    try
    =SUMPRODUCT((rng<=50)*(IFERROR(LEFT(FORMULATEXT(rng),4)="=SUM",0)))

  13. #13
    Registered User
    Join Date
    11-21-2018
    Location
    St. George, UT
    MS-Off Ver
    Excel 2015
    Posts
    10

    Re: Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

    Oh, I'd fixed that. Still calculating 3... (frustrating isn't it? lol)
    Now it's just the principle of the thing! There has to be a way...
    Last edited by peculiar101; 11-21-2018 at 02:33 PM.

  14. #14
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

    Show me the formula you have to get the value 72.

  15. #15
    Registered User
    Join Date
    11-21-2018
    Location
    St. George, UT
    MS-Off Ver
    Excel 2015
    Posts
    10

    Re: Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

    =sum(g11:g12)

  16. #16
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

    Ok

    Last try, I suppose

    =SUMPRODUCT((rng<=50)*(IFERROR(LEFT(FORMULATEXT(rng),4)<>"=SUM",0)))

  17. #17
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

    Quote Originally Posted by peculiar101 View Post
    Thanks, but I don't want to count the formulas...
    Hi, sorry should have said select constants. However I missed the <= 50 bit.

    Here's the adjusted UDF

    Please Login or Register  to view this content.

  18. #18
    Registered User
    Join Date
    11-21-2018
    Location
    St. George, UT
    MS-Off Ver
    Excel 2015
    Posts
    10

    Re: Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

    Quote Originally Posted by José Augusto View Post
    Ok

    Last try, I suppose

    =SUMPRODUCT((rng<=50)*(IFERROR(LEFT(FORMULATEXT(rng),4)<>"=SUM",0)))
    Returns 0 :/

  19. #19
    Registered User
    Join Date
    11-21-2018
    Location
    St. George, UT
    MS-Off Ver
    Excel 2015
    Posts
    10

    Re: Formula to count number of cells containing entered numbers but NOT a cell with =SUM()

    Quote Originally Posted by Richard Buttrey View Post
    Hi, sorry should have said select constants. However I missed the <= 50 bit.

    Here's the adjusted UDF

    Please Login or Register  to view this content.
    That works!!! Thank you!

+ 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] Altering formula to add cell numbers rather than count the cells
    By Hawkmoth1 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-22-2017, 12:13 PM
  2. [SOLVED] need a total count of number of times a value is entered in a cell
    By 2Sassy in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 11-24-2015, 04:31 PM
  3. Replies: 4
    Last Post: 09-03-2015, 06:20 PM
  4. [SOLVED] Formula needed to only count total cells entered and not count adjacent text entered cells
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-07-2013, 06:22 PM
  5. Replies: 6
    Last Post: 12-22-2012, 05:04 PM
  6. Creating a number entry cell to list entered numbers?
    By Excel_newbieee in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-25-2010, 08:11 AM
  7. numbers being entered show in formula bar but not in cell?
    By Jim in Florida in forum Excel General
    Replies: 2
    Last Post: 05-13-2005, 02:06 PM

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