Check if a cell contains specific text

I am trying to do a check to see if a cell contains specific text (but may also include other text). I thought this might be accomplished with an 'if' statement. Is this possible in Numbers?

iMac G5 1.8Ghz, Mac OS X (10.4.2)

Posted on Aug 22, 2009 10:23 PM

Reply
7 replies

Nov 2, 2009 9:01 PM in response to victor.gm

I am assuming the word "carrot" can appear multiple times within the same cell so the COUNTIF function will not work for this case.

Set up an auxiliary (second) table that is the same size as your "matrix". Each cell in this new table corresponds to a cell in your "matrix". Each of these cells will count how many times "carrot" appears in the corresponding cell of the "matrix". The formula below will count how many times the letters "carrot" appear in that exact order in a cell. In other words, "carrotstick" is also included in the count. Capitalization is not a factor. It assumes your "matrix" top left corner is cell B2 of Table 1.

Table 2 cell B2=(LEN(UPPER(Table 1 :: B2))-LEN(SUBSTITUTE(UPPER(Table 1 :: B2),UPPER($A$1),"")))/LEN($A$1)

Copy or fill that formula to the rest of the cells.

Table 2 cell A1 = carrot (the word you are looking for)

Somewhere else have a cell that sums the cells in Table 2.

The formula works by removing all instances of the word "carrot" from the string then subtracting the length of the new string from the length of the original and dividing that by the length of the word "carrot". The result is the number of times "carrot" appears in that particular string.

You could put a space before and/or after "carrot" in cell A1 to avoid counting words such as "carrotstick" but if "carrot" is the first and/or last word of the string, it will not get counted because that space will not be there in the string.

Message was edited by: Badunit

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Check if a cell contains specific text

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.