How can I combine these two formulas into one

Bassie

Board Regular
Joined
Jan 13, 2022
Messages
66
Office Version
  1. 2019
Platform
  1. Windows
Hi,

So I basically wanna do two different things in the same formula. I got a working formula for both but I don't know how to combine them. I have a column full of sentences and what I want to do is to uppercase the first letter of the sentence and remove a . at the end of the sentence (if there is one).

Uppercasing only the first letter of a sentence:
=UPPER(LEFT(E19,1))&RIGHT(E19,LEN(E19)-1)

Removing the . after a sentence (if there is one)
=IF(RIGHT(E19,1)=".",LEFT(E19, LEN(E19) - 1),E19)

Is there a way to combine them? I am not a huge fan of helper columns as I would like my worksheets to look clean.

Thanks a lot in advance!
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Excel Formula:
=UPPER(LEFT(IF(RIGHT(E19,1)=".",LEFT(E19, LEN(E19) - 1),E19),1))&RIGHT(IF(RIGHT(E19,1)=".",LEFT(E19, LEN(E19) - 1),E19),LEN(IF(RIGHT(E19,1)=".",LEFT(E19, LEN(E19) - 1),E19))-1)
 
Upvote 0
Another option
Excel Formula:
=REPLACE(IF(RIGHT(E19,1)=".",LEFT(E19, LEN(E19) - 1),E19),1,1,UPPER(LEFT(E19)))
Or if the . will only ever appear at the end of the text
Excel Formula:
=REPLACE(SUBSTITUTE(E19,".",""),1,1,UPPER(LEFT(E19)))
 
Upvote 0
Solution
Excel Formula:
=UPPER(LEFT(E19))&MID(E19,2,LEN(E19)-1-(RIGHT(E19)="."))
 
Upvote 0
Another option
Excel Formula:
=REPLACE(IF(RIGHT(E19,1)=".",LEFT(E19, LEN(E19) - 1),E19),1,1,UPPER(LEFT(E19)))
Or if the . will only ever appear at the end of the text
Excel Formula:
=REPLACE(SUBSTITUTE(E19,".",""),1,1,UPPER(LEFT(E19)))
Thank you so much!!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
Glad we could help & thanks for the feedback.
Thanks so much again!

I had a small follow up question, is it also possible to remove any ; or , at the end of the sentence?

If not still massive thanks! this community is amazing.
 
Upvote 0
Will those only ever appear at the end of the text, or could they also be in the middle?
 
Upvote 0
One option:

Excel Formula:
=UPPER(LEFT(E19))&MID(E19,2,LEN(E19)-1-SWITCH(RIGHT(E19),".",1,",",1;";",1,0))

Another is:

Excel Formula:
=UPPER(LEFT(E19))&MID(E19,2,LEN(E19)-1-ISNUMBER(FIND(RIGHT(E19),".,;")))
 
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,593
Members
452,654
Latest member
mememe101

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