Hyphens and comparisons

Jackeb

Board Regular
Joined
Mar 20, 2002
Messages
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
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
On 2002-04-17 03:05, Jackeb wrote:
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

[1]

=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.
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,386
Messages
6,119,215
Members
448,874
Latest member
b1step2far

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top