ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Avoiding counting the same cell twice (https://www.excelbanter.com/excel-worksheet-functions/109303-avoiding-counting-same-cell-twice.html)

JRD

Avoiding counting the same cell twice
 
Please help, I'm stuck.

How can I count the number of cells containing certain words but avoid
counting the same cell twice.

E.g.

Column A
A
B
C A
B A
A B
B
A

How do I count the number of cells containing A added to the number of cells
that contain B without double counting those that contain A and B

The answer in the above example should be 6 (NOT 7)

Many thanks


Nobody

Avoiding counting the same cell twice
 
=SUMPRODUCT(--(LEFT(A1:A7,1)={"A","B"}))

---------------
mama no teeth

"JRD" wrote:

Please help, I'm stuck.

How can I count the number of cells containing certain words but avoid
counting the same cell twice.

E.g.

Column A
A
B
C A
B A
A B
B
A

How do I count the number of cells containing A added to the number of cells
that contain B without double counting those that contain A and B

The answer in the above example should be 6 (NOT 7)

Many thanks


Aladin Akyurek

Avoiding counting the same cell twice
 
One way...

If you download and install the latest version of the morefunc.xll
add-in, you can invoke:

=SUM((REGEX.SUBSTITUTE(UPPER(A2:A8),"[ AB]","")="")+0)-COUNTBLANK(A2:A8)

which must be confirmed with control+shift+enter, not just with enter.

JRD wrote:
Please help, I'm stuck.

How can I count the number of cells containing certain words but avoid
counting the same cell twice.

E.g.

Column A
A
B
C A
B A
A B
B
A

How do I count the number of cells containing A added to the number of cells
that contain B without double counting those that contain A and B

The answer in the above example should be 6 (NOT 7)

Many thanks



All times are GMT +1. The time now is 04:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com