Trim Function

Rick__

New Member
Joined
Mar 18, 2016
Messages
20
Hi,

Could someone help me or point me in the right direction, I have this formula

=LEFT(MID(A1,FIND("/",A1)+1,LEN(A1)),FIND("/",MID(A1("/",A1)+1,LEN(A1)))-1)

It extracts the middle part of:

1113987 / TBA / Apples

So the result will be

TBA

However I have a number of these which sometimes have a space before the TBA and sometimes not.

I would like to use the TRIM function in the formula to remove these spaces as part of the formula, but am having difficulties trying to figure out were to insert it into the formula.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Your formula does not work, it is returning errors saying that it does not have enough arguments.
Are you sure that you copied it correctly?

When you getting it working, you should be able to wrap the whole thing in TRIM, i.e.
Code:
=TRIM(formula)
 
Upvote 0
I did what you said and just wrapped it in the TRIM formula and it has worked perfectly

=TRIM(LEFT(MID(A2,FIND("/",A2)+1,LEN(A2)),FIND("/",MID(A2,FIND("/",A2)+1,LEN(A2)))-1))

Thank your for your help with this
 
Upvote 0
You are welcome!
 
Upvote 0

Forum statistics

Threads
1,215,028
Messages
6,122,749
Members
449,094
Latest member
dsharae57

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