XL: Counting Cells in a Range that Contain Text StringLast reviewed: August 20, 1997Article ID: Q28262 |
SUMMARYTo count the number of cells in a range that contain a particular character or characters, use the following array formula in a single cell (array formulas must be entered by pressing COMMAND+ENTER):
=SUM(IF(NOT(ISERROR(SEARCH("search text",range))),1))This formula searches for the occurrence of the search text in a cell, returns #VALUE! if an occurrence is not found, and then counts the number of nonerror values. For example, suppose you want to search for the text "my" in the following range of cells:
+---+---------+ | | A | +---+---------+ | 1 | mytext | +---+---------+ | 2 | text | +---+---------+ | 3 | textmy | +---+---------+ | 4 | temyxt | +---+---------+The formula =SUM(IF(NOT(ISERROR(SEARCH("my",$A$1:$A$4))),1)) will return a value of 3 because "my" occurs three times in the range A1:A4.
|
Additional reference words: 1.00 1.03 1.04 1.06 1.50 2.20 3.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |