Computing.Net > Forums > Programming > Excel search and rank code

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Excel search and rank code

Reply to Message Icon

Name: newton_p
Date: June 10, 2009 at 06:24:54 Pacific
OS: Windows XP pro SP3
Subcategory: General
Comment:

Hi
Does anyone have a code for searching for 4-5 codes within columns in a single excel worksheet then returning the list of matching rows, ordered by greatest number of matches first. the total dataset is only around 200 rows

Many thanks

Or can anyone recommend a basic online course for learning how to write codes for excel etc



Sponsored Link
Ads by Google

Response Number 1
Name: ghostdog
Date: June 10, 2009 at 09:25:44 Pacific
Reply:

show sample of your excel file, then describe what you want the output to look like.


0

Response Number 2
Name: newton_p
Date: June 10, 2009 at 11:41:41 Pacific
Reply:

Not sure how to upload a file?

I want to search for a code A1,B2,C3 for all matches in column B, I want the result to show all matches, so from the list below the result would be: number 4, (as exact match) then 1,3 (as they both have 2 matches) and finally 2 (with just one match)

1 A3,B2,C3
2 A2,B2,C2
3 A1,B1,C3
4 A1,B2,C3
5 A2,B1,C1

This is the code I am using at the moment: to match code in J14 with codes in Column B, but it only shows an exact match, how do I make it list all part matches and rank them?

Sub Search()
Range("F25").CurrentRegion.ClearContents: Range("F25") = "Matches"
FindWhat = UCase(Range("J14"))
For Each Cell In Range("B2", Range("B" & Rows.Count).End(xlUp))
If InStr(Cell, FindWhat) <> 0 Then
Cell.Offset(, -1).Resize(, 3).Copy Range("F" & Rows.Count).End(xlUp).Offset(1, 0)
End If
Next Cell
End Sub


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Excel search and rank code

Perl search and replace www.computing.net/answers/programming/perl-search-and-replace/14586.html

Searching and sorting datasets www.computing.net/answers/programming/searching-and-sorting-datasets/10555.html

Batch File search and delete file www.computing.net/answers/programming/batch-file-search-and-delete-file/16386.html