Need Excel formula to delete the last word in a cell

jhillas

New Member
Joined
Dec 3, 2003
Messages
10
Hello,

This seems so easy, but I can't get it to work correctly.
If a cell or group of cells contains a product description, and the last word is undesired in all the cells, how would we go about this? I've found this formula to delete the first word:

=RIGHT(A1,LEN(A1)-FIND(" ", A1,1))

before:
This is a test.

after
is a test.

What is desired is:
This is a

Thank you.
 
Yogi Anand said:
...

The formula in cell B1 is ...

=LEFT(TRIM(A1),FIND("~",SUBSTITUTE(A1," ","~",LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))))-1)

How does this differ from the one I posted?
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Aladin Akyurek said:
Yogi Anand said:
...

The formula in cell B1 is ...

=LEFT(TRIM(A1),FIND("~",SUBSTITUTE(A1," ","~",LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))))-1)

How does this differ from the one I posted?
Hi Aladin:

Unless I am missing something here -- to delete the last word in the string 'This is a test.' -- your formulation results in ...

This

My formulation results in ...

This is a
 
Upvote 0
Yogi Anand said:
Aladin Akyurek said:
Yogi Anand said:
...

The formula in cell B1 is ...

=LEFT(TRIM(A1),FIND("~",SUBSTITUTE(A1," ","~",LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))))-1)

How does this differ from the one I posted?
Hi Aladin:

Unless I am missing something here -- to delete the last word in the string 'This is a test.' -- your formulation results in ...

This

My formulation results in ...

This is a

I see there is an omission... It should be:

=TRIM(LEFT(A1,SEARCH(CHAR(127),SUBSTITUTE(A1," ",CHAR(127),LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))))
 
Upvote 0
Aladin Akyurek said:
=TRIM(LEFT(A1,LEN(A1)-SEARCH(CHAR(127),SUBSTITUTE(A1," ",CHAR(127),LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))))

Corrected for an omission...

=TRIM(LEFT(A1,SEARCH(CHAR(127),SUBSTITUTE(A1," ",CHAR(127),LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))))
 
Upvote 0
Thank you . but in my case i have to delete last word only if the last complete word is in Upper case.

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,215,056
Messages
6,122,907
Members
449,096
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