Removing Characters to the Right of a Value based on Data from a Separate Sheet

Argonous

New Member
Joined
Sep 23, 2004
Messages
15
Office Version
  1. 2019
Platform
  1. Windows
Greetings Everyone,

I have a workbook with two sheets. The first contains over 7,000 unique values that relate to a location. The second contains a set of characters that everything to the right of needs to be removed from the original value (the suffix is what makes the original value unique). I need a formula that can take the suffix value from Sheet2 and remove it, and everything to the right of it, from the original value on Sheet1. An example of what I am trying to do is below, with the desired result in the Results column.

After searching for a bit, I found the following formula, but this requires an exact entry for every suffix in the list. This would require identifying each and every unwanted suffix, which is what I am trying to avoid.
Excel Formula:
=TRIM(SUBSTITUTE(A14,TRIM(IFERROR(LOOKUP(1E+100,SEARCH(Sheet2!$A$1:$A$22,A14,1),Sheet2!$A$1:$A$22),"")),""))

Any suggestion on a edit to the above formula or a more efficient one that can be used?

Thanks all!

Sheet1
Full LocationResult
3A1114-013A1114
3A1114-023A1114
3A1116-INS3A1116
3A1120CONF3A1120
3A2106LABTRK-013A2106
3A2106LABTRK-023A2106
HP252macSRHP252
HP254macINSHP254
HP254mac01HP254
HP254mac02HP254
3C205DECOM3C205
3E1100-CNC13E1100
3E1100-CNC23E1100
3E2103A-013E2103A
3E2103A-023E2103A

Sheet2
Remove to the Right of This
-
LABTRK
mac
CONF
DECOM
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,214,976
Messages
6,122,543
Members
449,089
Latest member
davidcom

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