Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, and thanks in advance for any help....
Below, I have a section of a sub routine that counts the "words" of a cell, and finds a word with the same amount of "words". If it is found, it copys the cell to the next column. It works, but I need to modify it. I need it to compare "number of words +2". Example: number of words to be compare with: "A B C" (3 words) I want returned (as an exact match) "x A B C x" (5 words) Another Example: number of words to be compare with: "A B C D E F" (6 words) I want returned (as an exact match) "z A B C D E F z" (8 words) This is the code: --------------------------------------------------------------------------------- With Sheets("Temp") For Each Cell In .Range(.Cells(1, UBound(FWhat) + 1), _ .Cells(65536, UBound(FWhat) + 1).End(x1Up)) 'If Len(Cell.Value) - Len(Replace(Cell.Value, " ", "")) = If Len(Cell.Value) - Len(Replace(Cell.Value, " ", "")) = _ LastCol Then .Cells(i + 1, LastCol + 1).Value = Cell.Value ExactMatch = True i = i + 1 End If Next Cell If Not ExactMatch Then .Cells(i + 1, LastCol + 1).Value = "No Exact Match" End If End With End Sub -------------------------------------------------------------------------------- Thanks, Jim ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Comparing values in two columns | Excel Discussion (Misc queries) | |||
Help with Comparing values and retrieving values in Excel!!!!!! | Excel Worksheet Functions | |||
Comparing values between columns only when there are values in bot | Excel Worksheet Functions | |||
Comparing values | Excel Discussion (Misc queries) | |||
comparing two values | Excel Worksheet Functions |