LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Comparing Values Needs Correction

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
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
Comparing values in two columns P.hamsa Excel Discussion (Misc queries) 4 May 13th 07 04:50 PM
Help with Comparing values and retrieving values in Excel!!!!!! [email protected] Excel Worksheet Functions 1 November 17th 06 12:21 AM
Comparing values between columns only when there are values in bot Mark K Excel Worksheet Functions 1 February 19th 06 06:47 PM
Comparing values Dirk_Bob Excel Discussion (Misc queries) 2 August 24th 05 09:39 PM
comparing two values Jerry Excel Worksheet Functions 2 March 2nd 05 04:34 PM


All times are GMT +1. The time now is 04:55 PM.

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

About Us

"It's about Microsoft Excel"