+ Reply to Thread
Results 1 to 5 of 5

Counting cells and ignoring references

Hybrid View

  1. #1
    Registered User
    Join Date
    11-29-2008
    Location
    Littleton, CO
    Posts
    12

    Thumbs up Counting cells and ignoring references

    Hello,

    I have a range of cells (B6:M6) and I want to count how many have data. My problem is that all of the cells reference cells on another worksheet. Every cell starts out like =Bethlehem!B6. I want to ignore cells that have a reference in it when I count. I know how to do it if you want to ignore these cells as follows: =countif(b6:m6,"<> 0"). Those cell references return a 0 if they have no data in them. However, a user might actually enter a 0 in the referenced cell and I need to count that one. The above formula would exclude it. Any suggestions?

    Thank you very much,

    Dave
    Last edited by coachdave; 08-21-2009 at 11:19 AM. Reason: Solved

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Counting cells and ignoring references

    Hi Dave,

    Can you adjust your formulas to something like:

    =IF(Bethlehem!B6="","",Bethlehem!B6)

    if so, you could then just use

    =COUNT(B6:M6)

    to get the number of cells with values in them.

  3. #3
    Registered User
    Join Date
    11-29-2008
    Location
    Littleton, CO
    Posts
    12

    Re: Counting cells and ignoring references

    Paul,

    Thanks for the suggestion. However, the referenced cells never seem to have a value of "". The value is either an actual number entered by the user or the reference and the reference's value seems to be 0 not "".

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Counting cells and ignoring references

    Dave, I think Paul was suggesting you alter your initial formulae in B6:M6 such that should the target cell be blank a Null is returned to the cell rather than 0, so

    B6: =IF(Bethlehem!B6="","",Bethlehem!B6)
    copied to M6

    The above simply checks to see if the cell B6 on Bethlehem sheet is blank or not, if it is blank it returns a Null value else it returns the content of B6 (this will include valid 0 entry)

    Once the above is input you can then as advised by Paul use the COUNT function if we're assuming B6:M6 on Bethlehem sheet contain numerics

    =COUNT(B6:M6)

    The Nulls you returned for the otherwise blank cells will be ignored in the above as a Null is in essence a 0 length text string and thus not numeric, COUNT only looks at numeric values.

    If you're returning a mixture of text and numbers then another alternative would be:

    =COUNTA(B6:M6)-COUNTBLANK(B6:M6)

    This works because COUNTBLANK treats Null as Blank (COUNTA does not).

  5. #5
    Registered User
    Join Date
    11-29-2008
    Location
    Littleton, CO
    Posts
    12

    Thumbs up Re: Counting cells and ignoring references

    Thanks to both of you.

    Paul when I replied to you I did change the formulas but it wasn't working. I must have had a typo in there because I changed them all again and I am getting the count that I want.

    Agai, thanks to both of you for your help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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