1

Could you help me to understand, How to search substrings of text with case sensitivity in an excel column and highlight the rows respectively.

My excel second column consists of value (((...))) but in few cells of the same column consists of value (((..-))) or (((-..))) and I want to extract these exceptional cells and highlight the rows respectively.

Similarly, I have third column of the same excel consists of AAGUC value and in few cells of the same column consists of value aAgCu. Now, I want to extract these case sensitive cells and highlight the respective rows.

How can I do this? Do I need to write a program for this? Or can I do it in excel sheet itself?

2 Answers 2

0

Spreadsheet only approach:

For your second column, use the FIND function to identify cells with "-" in them. Set a conditional format using the formula to highlight the found cell. For example, for a (((-...))) in cell B2, set conditional format using the formula =FIND("-",B2). The format can be copied down the column. Alternatively, use the formula in a helper column to return a flag value or the contents of the cell(s): In cell F2, say, enter =IFERROR(IF(FIND("-",b2),b2),""), which returns the cell contents if they include "-", and returns an empty string otherwise.

For third column, along the same lines you can use the following formula =NOT(EXACT(c2,LOWER(c2)) in a conditional format or the formula =IF(NOT(EXACT(c2,LOWER(c2)),c2,"") in a helper column. Note that the latter formula only tests for mixed case and will fail on "aagcu".

0

You can use the Excel find / find and replace that has an option to be case sensitive. (MatchCase=true)

If you need to do this from code, you can use a VBA function, Here is some sample code.

Range("B2:B10").Select
Selection.Replace What:="aAgCu", Replacement:="XX", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False

If you don't want to replace the values, you can copy your column in VBA to a temp column, then run the find and replace to highlight or indicate which columns need to be affected

1
  • Thanks Richard really a great idea... But i have just showed the problem with one example. but the problems comes because there are many cases of case sensitivity like cells might contain "AacGU" or "Caugu". Nov 30, 2012 at 6:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.