How to combine TRIM and LEFT to remove space and extract the first words

ExcelNoobUser

New Member
Joined
Jan 30, 2024
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Hi, I wanted to ask if there's any way for me to use TRIM to remove the space in my cell and then left to get the first word in one cell, I tried to substitute to remove the space but they still output the second word after the space. Here is an example

42345566G Austin Texas

I want to only output 42345566G and get rid of all of the spaces before it, when I used substitute with lens it gave me 42345566G Austin with the spaces still intact, is there any formula that I could try to solve this, I even tried left trim but that only got rid of the spaces and outputted 42345566G Austin Texas, instead of just 42345566G that I thought it would output
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Apparently the spaces were removed when I posted it, I'll use _ to make it easier to visualize

______42345566G Austin Texas

I want to only output 42345566G, when using substitute and lens I got ______42345566G Austin , and when using left trim I outputted 42345566G Austin Texas. Is there any way for me to only output 42345566G and remove the spaces before it using LEFT and TRIM functions
 
Upvote 0
Trim removes all spaces on the left and right sides of the text.
Left takes a specified number of characters from the left side of a string. "42345566G" is 9 characters long, so you specify 9.

The textbefore takes all text before the first occurrence of the space, after trimming the spaces in front. This would be better if there were a variable number of characters in your string that needed to be extracted.
 
Upvote 1

Forum statistics

Threads
1,215,071
Messages
6,122,964
Members
449,094
Latest member
Anshu121

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