In the attached excel workbook, what code would I use to identify all rows that contain a number in column B?

PDSWSS used Ask the Experts™
I have an excel file with the columns subject ID and diagnosis (about 3000 rows).

For each subject ID there are 5 diagnosis: MDE, Manic, Hypomanic, Mixed and Dysthymic.
I need to automate the identification of all subject IDs where at least one of the 5 diagnoses in column B is followed by a number.  Please see attached sample file. In the sample file, if at least of of the 5 diagnoses is followed by a number, I highlighted all five.
I would like to have code that would either highlight all five diagnosis for any subject where at least one of the five was followed by a number or copy and paste the subject ID and the data in the  adjacent cells in row B into another spread sheet as shown in the sample file (output sheet).
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You can enter this formula on row 2 of any blank column and copy it all the way down


You can now filter on the True values

You can use conditional formatting to perform the task (please check the attached file).

I have used following Formula

Also please refer : for more help.

Milind MK


Hi Milind,

Thanks for your response. Not clear to me from the attached file how your solution works.
Where do you paste the formula?
And what is the meaning of the green highlighted Subjecxt IDs?
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.


Saqib Husain, Syed:

Thanks for your solution. Appears to work perfectly.
I am waiting for a response from the other expert before I award points.
Thanks again
Apparently he did not understand the requirement correctly. That solution is highlighting all items which have exactly 5 diagnoses. Less than 5 diagnoses is not highlighted.


Your code highlighted all cells in the column that contained a number.You were close enough. Still solves my issue. Thanks
My apologies. I forgot to mention that the formula is an ARRAY formula. Do you know how to enter an array formula?


What I did worked - copied and pasted into C2, pressed enter and then clicked on the left bottom corner of the cell which filled the entire column with either False or True (in correct place).


Thanks again. Very helpful solution.
I still feel that you are missing the real result. Take a look at the formula same formula applied in both ways in the attached file.


Well your are correct.  This completely addresses my question.

Thanks for being so honorable.  PDSWSS

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial