Results 1 to 7 of 7

20110315, 12:24 #1
 Join Date
 Dec 2009
 Location
 Philadelphia, PA
 Posts
 17
 Thanks
 1
 Thanked 0 Times in 0 Posts
Is there a numeric wildcard for COUNTIF?
In the countif function, we all know that we can use the * as a wildcard to count any text (any nonblank cell). For example, =COUNTIF(a2:a10,"*")
Is there a wildcard to count any number?
(In our workbook, we can't format the column as text.)

20110315, 12:37 #2
 Join Date
 Jan 2001
 Location
 Redcliff, Alberta, Canada
 Posts
 4,066
 Thanks
 2
 Thanked 5 Times in 5 Posts
Er, is the COUNT function what you are looking for?
[b]Catharine Richardson (WebGenii)
WebGenii Home Page
Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

20110315, 12:57 #3
 Join Date
 Dec 2009
 Location
 Philadelphia, PA
 Posts
 17
 Thanks
 1
 Thanked 0 Times in 0 Posts
In column A, we have either a number or a blank. And in column B, either an "x" or a blank. First, we need to examine each cell in column A, and if it has a number, examine its related cell in column B. Second, if the related cell has an "x", add it to the count, the count of valid "x"'s.

20110315, 13:35 #4
 Join Date
 Dec 2009
 Location
 Philadelphia, PA
 Posts
 17
 Thanks
 1
 Thanked 0 Times in 0 Posts
Okay, I just figured out a solution. We can count all "x"'s in column B and then subtract all blanks in column A. There are actually four scenarios we have to test, but that serves as the model.

20110315, 13:39 #5
 Join Date
 Dec 2009
 Location
 East Coast, USA
 Posts
 993
 Thanks
 8
 Thanked 43 Times in 43 Posts
In Excel 2007 and later try COUNTIFS
=COUNTIFS(range1,">=1",range2,"=x")

20110315, 13:46 #6
 Join Date
 Jan 2001
 Location
 Redcliff, Alberta, Canada
 Posts
 4,066
 Thanks
 2
 Thanked 5 Times in 5 Posts
[b]Catharine Richardson (WebGenii)
WebGenii Home Page
Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

20110316, 10:22 #7
 Join Date
 Jan 2001
 Location
 West Long Branch, New Jersey, USA
 Posts
 1,937
 Thanks
 6
 Thanked 9 Times in 7 Posts
Hi NJRob,
Try the following formula, which will work in any version of Excel (at least it works in 2003 and, I assume, has not been obsoleted in later versions):
{=SUM(ISNUMBER(A1:A5)*(B1:B5="x"))}
A couple of comments:
1. The { } mean the formula is an "array" formula. You do NOT type { }. Instead of hitting enter when you're done with the formula, you hit CTRL+SHIFT+enter  that tells Excel this is an array formula and Excel puts in the { } to show this. An array formula is needed to have Excel look at a range of cells in cases (with a "regular" formula) where it normally expects only 1 cell.
2. The ISNUMBER builtin function examines the cells to see if the content is a number. In this case, it examines the range I've shown (change for your case). This may be the wildcard you were looking for. The function returns 1 for true and 0 for false. In this case, it returns 5 1's and 0's because of the 5 cells.
3. The B1:B5 compares the cell contents to lower case x (you didn't mention the case; if it's upper case or a mix, changes would need to be made using the LOWER or UPPER builtin functions). Again, return 1 for true and 0 for false
4. By multiplying the result of the five 1's and 0's from items 2 and 3, the result is 1 if BOTH the item in Col A is a number and its corresponding item in Col B has an x; 0 for any other condition (this takes care of your 4 cases). Note that an array formula such as this has to have the same number of elements for each part  it would be an error to do A1:A5 while doing B1:B6.
5. By summing the 1's from #4, you get the number of rows where both Col A has a number and Col B has an x.
The above formula (along with a few variants like using the builtin function SUMPRODUCT) are ways to get around the limitation in Excel 2003 (and before) of not being able to examine multiple conditions in a SUM or COUNT function.
You could also do something like
{=SUM(IF(ISNUMBER(A1:A5),IF(B1:B5="x",1,0),0)}
I'm not totally sure what you meant by a "number" wildcard in your original post but hopefully ISNUMBER fits the bill. Another approach is just to see if the cell's contents is smaller (or larger) than some number which your data would never take on with COUNTIF. Or, better, just use the COUNT function as suggested (since it ignores non numeric contents).
HTH
(NJ) Fred