chilly_bang

Board Regular
Joined
Jun 17, 2016
Messages
57
Hi

I have in A and B urls. They are all different, but some of them, like in A2 and B2, have same IDs. Example:

Code:
[TABLE="width: 390"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]example.com/id/1/baz/[/TD]
[TD]site.com/id/2/ban/[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD]example.com/id/3/boom/[/TD]
[TD]site.com/id/3/baff/[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD]example.com/id/123/foo/[/TD]
[TD]site.com/id/321/bar/[/TD]
[/TR]
</tbody>[/TABLE]

According to this example i want to get
  • into C1 - false,
  • into C2 - true,
  • into C3 - false
`True` means IDs are same.

How can i compare certain parts of strings to do so?
 
Last edited:

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Try in C1:

=TRIM(MID(SUBSTITUTE(A1,"/",REPT(" ",199)),400,199))=TRIM(MID(SUBSTITUTE(B1,"/",REPT(" ",199)),400,199))

if the IDs are always between the 2nd and 3rd slashes.
 
Upvote 0
A little longer:

=LEFT(SUBSTITUTE(MID(A1,FIND("/id/",A1)+4,99),"/",REPT(" ",99)),99)=LEFT(SUBSTITUTE(MID(B1,FIND("/id/",B1)+4,99),"/",REPT(" ",99)),99)

but it looks for /id/ in the text, and compares what follows it. There should always be a trailing slash.
 
Upvote 0
Thank you! The second one works like a charm - had some difficulties to adopt it to german Excel, but now it works as expected!
 
Upvote 0

Forum statistics

Threads
1,214,588
Messages
6,120,412
Members
448,959
Latest member
camelliaCase

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