Prevent proper case of letters following a comma

tkroper

Active Member
Joined
Feb 2, 2007
Messages
255
Hi eveyone!

When using the PROPER function, it capitalizes the first letter in a text string and any other letters in text that follow any character other than a letter, and converts all other letters to lowercase.

However, if A1 contains the text "2-cent's worth"; then =PROPER(A1) will return the following result: "2-Cent'S Worth".

Is there a way to prevent the PROPER function from capitalizing the first letter following the apostrophe?

Thank you!
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
If there's only 1 apostrophe in the string, you can use:

=REPLACE(PROPER(A1),FIND("'",A1)+1,1,LOWER(MID(A1,FIND("'",A1)+1,1)))
 
Upvote 0
Thank you NBVC!

If I understand correctly, this will only work if there is an apostophe present in the text in A1.

Is there a way to make this conditional upon the occurance of an apostrophe in A1? For example, if A1 contains the text, "2-cents".

Thanks again!
 
Upvote 0
If only an s will follow an '

how about,
=SUBSTITUTE(PROPER(A1),"'S","'s")

Yeah, I should've thought about that too....I guess most likely only an "s" would follow the apostrophe.... This way if multiple 's combinations appear they can all be substituted at once.
:)
 
Upvote 0
Thank you NBVC!

If I understand correctly, this will only work if there is an apostophe present in the text in A1.

Is there a way to make this conditional upon the occurance of an apostrophe in A1? For example, if A1 contains the text, "2-cents".

Thanks again!

You can do that this way:

=IF(ISNUMBER(FIND("'",A1)),REPLACE(PROPER(A1),FIND("'",A1)+1,1,LOWER(MID(A1,FIND("'",A1)+1,1))),PROPER(A1))


I am not sure if you saw the solution provided by PA HS Teacher, it's simpler and better if you always have 's....then you would use.

=IF(ISNUMBER(FIND("'",A1)),SUBSTITUTE(PROPER(A1),"'S","'s"),PROPER(A1))
 
Upvote 0
Thank you PA HS Teacher!

Yes - I anticipate only the letter "s" will follow an apostrophe. That seems to do the trick.
 
Upvote 0
If there was any possibility of other letters following an apostrophe (e.g. in word's like can't, we'll etc.) perhaps try

=SUBSTITUTE(PROPER(SUBSTITUTE(A1,"'","z-z")),"z-Z","'")
 
Upvote 0
If there was any possibility of other letters following an apostrophe (e.g. in word's like can't, we'll etc.) perhaps try

=SUBSTITUTE(PROPER(SUBSTITUTE(A1,"'","z-z")),"z-Z","'")

Neat trick Barry! :cool:
 
Upvote 0
Thank you all very much!!

If you're interested, here's how I used all of your advice:

I have a column full of data (A1:A100). One cell in the range contains the text, "D.B.A.:" and the cell immediately below it contains the text, "ELMER'S, INC." Using this formula:

=SUBSTITUTE(PROPER(INDEX(Data!$A$1:$A$100,MATCH("D.B.A.:",Data!$A$1:$A$100,0)+1)),"'S","'s")

I get this result: "Elmer's, Inc."

Another cell in the range contains the text, "ELMERS SHOP". I realize the data entry person failed to include an apostrophe, but that doesn't matter for my purposes. This cell will either contain a DBA, or it will contain a string of text beginning with the word, "Insured". Using this formula:

=IF(A3="Insured*","",SUBSTITUTE(PROPER(A3),"'S","'s"))

returns this result: Elmers Shop (when a DBA is present, otherwise, it remains blank).

I appreciate all of you for your help on this. I certianly couldn't have figured it out on my own.
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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