Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 269
Default Determine if 2 cells share a common word

I have a list with two text columns. I want to identify the rows where the
cells share a common word. For example,
Fujitsu Consulting in col A and Software Engineer in col B would not share a
common word but
Starbucks in col A and Starbucks Barista in col B would share a common word.


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,836
Default Determine if 2 cells share a common word


Sub Highlight_Word()
Dim rng As Range
Dim Cell As Range
Dim start_str As Integer


myword = InputBox("Enter the search string ")

Mylen = Len(myword)
Set rng = Selection
For Each Cell In rng
' start_str = InStr(cell.Value, myword) '(case sensitive)
start_str = InStr(1, Cell.Value, myword, vbTextCompare) '(non case
sensivive)

If start_str Then
Cell.Characters(start_str, Mylen).Font.ColorIndex = 3
End If
Next
End Sub

Select Col A and Col B, then run the macro.
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"paul c" wrote:

I have a list with two text columns. I want to identify the rows where the
cells share a common word. For example,
Fujitsu Consulting in col A and Software Engineer in col B would not share a
common word but
Starbucks in col A and Starbucks Barista in col B would share a common word.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,766
Default Determine if 2 cells share a common word

Hi,

Let's say the entry is in A4:B4 and then goes downwards. Click on cell A4
and go to Conditional formatting. Write the following formula in
conditional formatting

=OR(ISNUMBER(SEARCH($A4,$B4)),ISNUMBER(SEARCH($B4, $A4)))

Select a format colour and click on OK. This will highlight all those
records (both columns), where the entry is found in the other column.

However please note that if one column has starbuck and the other has
starbucks, it will highlight both entries.

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"paul c" wrote in message
...
I have a list with two text columns. I want to identify the rows where
the
cells share a common word. For example,
Fujitsu Consulting in col A and Software Engineer in col B would not share
a
common word but
Starbucks in col A and Starbucks Barista in col B would share a common
word.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to determine the number of common factors? Eric Excel Discussion (Misc queries) 3 November 17th 07 07:31 PM
merge worksheets which share a common column? Neha Excel Worksheet Functions 1 February 20th 07 02:50 PM
Any function to determine the smallest common factor from a list? Eric Excel Discussion (Misc queries) 4 December 10th 06 07:47 PM
inserting rows at common word in a sheet Ankur Excel Discussion (Misc queries) 0 August 10th 05 11:18 AM
what three features in word,excel and powerpoint have n common? collegemom2005 New Users to Excel 1 June 11th 05 09:54 PM


All times are GMT +1. The time now is 04:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"