![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Posts: 81
|
Here is a good one..
I have an array filled with individual strings, the strings are something like this... A1D-WS-2346-78 and I would like to make the string like this A1DWS234678. Please be aware that the hyphens are in variable places and there are a variable number of hyphens. My ultimate aim is to compare two strings, call one the master and one the subject. The master is the one above, it contains a lot of information about a part, however the subject also contains the same information but only part of it, I need to compare the subject to every one of the master strings and find out if it appears anywhere within the master string... both ave hyphens but if i can remove the hyphens from both ten I can do a strait text comparison... One step at a time, I am trying to remove the hyphens and then I wil try and tackle the comparison, but any help on that would be very... and i mean very greatfuly recieved!! Cheers Ed PS, talk about summing diagonally.... this one hads gotta take the biscuit!! arrgghh |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
=ISNUMBER(SEARCH(B1,A1)) returns TRUE if the substring in B1 is a substring of the string in A1. [2] =SUBSTITUTE(A1,"-","") removes hyphens if they exist in the string in A1. [3] =ISNUMBER(SEARCH(SUBSTITUTE(B1,"-",""),SUBSTITUTE(A1,"-",""))) will return TRUE if the de-hyphenated substring in B1 is a substring of the de-hyphenated string in A1. Not sure whether you need de-hyphenating at all. |
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Posts: 81
|
sounds good... all i have to do now is put that into VBA and i am sorted... cheere,
and i do need to dehyphenate... unfortunatly |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|