Duplicates values when using the "&" to join results

Jonathan1726

New Member
Joined
Aug 27, 2019
Messages
2
Hello Guys, here is the situation:
I created a formula to extract the date on a string of text from any position, and I used the IF function to show the same value is the Date is not in the text.

Here is the example:

FORMULA:
=TRIM(IF(ISERROR(SEARCH("/",B14)),B14,LEFT(B14,SEARCH("/",B14)-3))&" "&IF(ISERROR(SEARCH("/",B14)),B14,RIGHT(B14,LEN(B14)-SEARCH("/",B14)-5)))

Raw Data Clean Data
B14- Jose $250 12/06/16 OTR Jose $250 OTR
B15- 250 Josefa otr 1/05/29 Mac 250 Josefa otr Mac
B16- 12/25/89 OTR Windows $152 OTR Windows $152
B17- Ana OTR Windows $152 Ana OTR Windows $152 Ana OTR Windows $152

<tbody>
</tbody>
The problem is that because I used the & to join the results, it is repeating the results when it does not find a date on the text (see B17 Underlined). How can I fix this?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hi & welcome to MrExcel.
Try
=TRIM(IF(ISERROR(SEARCH("/",B14)),B14,LEFT(B14,SEARCH("/",B14)-3))&" "&IF(ISERROR(SEARCH("/",B14)),"",RIGHT(B14,LEN(B14)-SEARCH("/",B14)-5)))
 
Upvote 0
Or,

=IFERROR(TRIM(REPLACE(B14,FIND("/",B14)-2,8,"")),B14)

Regards
Bosco
 
Upvote 0
In consider the data may have : "1/25/89 OTR Windows $152"

then, the above formula change to :

=IFERROR(TRIM(REPLACE(B14,MAX(1,FIND("/",B14)-2),8,"")),B14)

Regards
Bosco
 
Upvote 0

Forum statistics

Threads
1,215,055
Messages
6,122,902
Members
449,097
Latest member
dbomb1414

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