remove empty space from in front and end of an entry

goodstudent

New Member
Joined
Dec 8, 2023
Messages
15
Office Version
  1. 365
Platform
  1. Windows
AABB123 /// XYZ123
PQR123 @@@ MNO123

Hello Mr Excels,

I have these entries in each cell and there are spaces in front of, in the middle and at the end of each entries. I want to remove spaces only in front of and at the end of entries and I do not want to remove spaces that appear in between the entry. How can I achieve this please:

AABB123 /// XYZ123
So in the above I only want to remove spaces that appear before AABB123 and spaces that come after XYZ123.

PQR123 @@@ MNO123
So in the above I only want to remove spaces that appear before PQR123 and spaces that come after MNO123.

I can't use VBA. I need a formula please.

Thanks in advance for your support!
 
Last edited:

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
here my spaces before and after each entry in a cell got removed automatically. but imagine that there are spaces before and after each entry in each particular cell.
 
Upvote 0
Use Trim function

Libro1
AB
1AABB123 /// XYZ123AABB123 /// XYZ123
2PQR123 @@@ MNO123PQR123 @@@ MNO123
Hoja4
Cell Formulas
RangeFormula
B1:B2B1=TRIM(A1)


Is that what you need?

Thanks for your kind response and solution suggested. This looks fine to me and seems to work in the immediate. Let me work with several entries/ cell and I will let you know if it is working fine for all the entries.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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