Counting formulas referring to a range containing formulas

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
This formula counts non-blank values perfectly. But why does the formula countif(A2:D13; "*") gives 36? What does it include and exclude? Another weird thing. I wrote 0 in E2 and F2 is blank containing no formula. When I compare E2 and F2 with =E2=F2 it gives true, while exact formula gives false. However when D3 which contains formula and is "" is compared with E2 (=D2=E2) it gives false but when it's compared with F2 (=D2=F2) it gives true. =exact also gives true when D2 is compared with F2.
 
Upvote 0
This formula counts non-blank values perfectly. But why does the formula countif(A2:D13; "*") gives 36? What does it include and exclude? Another weird thing. I wrote 0 in E2 and F2 is blank containing no formula. When I compare E2 and F2 with =E2=F2 it gives true, while exact formula gives false. However when D3 which contains formula and is "" is compared with E2 (=D2=E2) it gives false but when it's compared with F2 (=D2=F2) it gives true. =exact also gives true when D2 is compared with F2.

1.

? and * are the so-called wild cards.

? stands for 1 token whose length (LEN) is 1; * stands for null or more tokens.

"?*" as criterion in COUNTIF(S) mean any text of length 1 or >1.

Thus:

=COUNTIFS(A2:D13,"?*")

counts all all text entries whose length >=1.

=COUNTIFS(A2:D13,"*")

counts all text entries including formula blanks (i.e., "").

2.

=E2=D2

is TRUE also (a) when E2 = 0 and F2 empty (does not contain any formula) or vice versa, because a formula in Excel reads an empty cell as 0; (b) when E2 contains a formula with "" as result (say ="") and F2 is empty.

Note that:

=EXACT(E2,F2)

under (a) >> FALSE and under (b) >> TRUE. EXACT assumes number comparison under (a), prompted by the presence of a 0 and text comparison under (b) prompted by the presence of "".

Hope this helps.
 
Upvote 0
Similar to Aladin's excellent answer:


Excel 2010
ABCDEFGH
1True Blank""
2 TRUEFALSEISBLANK(A2)ISBLANK(B2)
3TRUEEXACT(A2,B2)
4TRUEA2=B2
500LEN(A2)LEN(B2)
601COUNTIF(A2,"*")COUNTIF(B2,"*")
700COUNTIF(A2,"?*")COUNTIF(B2,"?*")
Sheet17
Cell Formulas
RangeFormula
B2=""
C2=ISBLANK(A2)
C3=EXACT(A2,B2)
C4=A2=B2
C5=LEN(A2)
C6=COUNTIF(A2,"*")
C7=COUNTIF(A2,"?*")
D2=ISBLANK(B2)
D5=LEN(B2)
D6=COUNTIF(B2,"*")
D7=COUNTIF(B2,"?*")
 
Upvote 0
Many thanks for the answer. :)



Similar to Aladin's excellent answer:

Excel 2010
ABCDEFGH
1True Blank""
2TRUEFALSEISBLANK(A2)ISBLANK(B2)
3TRUEEXACT(A2,B2)
4TRUEA2=B2
500LEN(A2)LEN(B2)
601COUNTIF(A2,"*")COUNTIF(B2,"*")
700COUNTIF(A2,"?*")COUNTIF(B2,"?*")

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet17

Worksheet Formulas
CellFormula
B2=""
C2=ISBLANK(A2)
D2=ISBLANK(B2)
C3=EXACT(A2,B2)
C4=A2=B2
C5=LEN(A2)
C6=COUNTIF(A2,"*")
C7=COUNTIF(A2,"?*")
D5=LEN(B2)
D6=COUNTIF(B2,"*")
D7=COUNTIF(B2,"?*")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
Many thanks for the answer. :)

1.

? and * are the so-called wild cards.

? stands for 1 token whose length (LEN) is 1; * stands for null or more tokens.

"?*" as criterion in COUNTIF(S) mean any text of length 1 or >1.

Thus:

=COUNTIFS(A2:D13,"?*")

counts all all text entries whose length >=1.

=COUNTIFS(A2:D13,"*")

counts all text entries including formula blanks (i.e., "").

2.

=E2=D2

is TRUE also (a) when E2 = 0 and F2 empty (does not contain any formula) or vice versa, because a formula in Excel reads an empty cell as 0; (b) when E2 contains a formula with "" as result (say ="") and F2 is empty.

Note that:

=EXACT(E2,F2)

under (a) >> FALSE and under (b) >> TRUE. EXACT assumes number comparison under (a), prompted by the presence of a 0 and text comparison under (b) prompted by the presence of "".

Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top