If last character is Upper Case

jespo1351

New Member
Joined
Apr 4, 2012
Messages
19
I am looking for a formula to detect if the last character of a cell is upper case and remove it if it is upper case. If it is not upper case, it will remain the same.

IF A1 Contains CheeseDoodlesR - I would like A2 to populate CheeseDoodles

Any help is greatly appreciated. I tried playing around with exact/right/upper but I can't connect any formulas together.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Maybe
Fluff.xlsm
AB
1
2CheeseDoodlesRCheeseDoodles
3CheeseDoodlesrCheeseDoodlesr
Sheet5
Cell Formulas
RangeFormula
B2:B3B2=IF(EXACT(UPPER(RIGHT(A2)),RIGHT(A2)),LEFT(A2,LEN(A2)-1),A2)
 
Upvote 0
The IF function is not case sensitive so that won't work. ;) You need to use Exact
 
Upvote 0
I like this better because it doesn't remove other characters (non-alphabet).

=IF(AND(CODE(D2)>64,CODE(D2)<91),LEFT(D2,LEN(D2)-1),D2)

Capital Letters A-Z are ascii code 65-90
 
Upvote 0
That only looks at the 1st character in the cell, not the last. ;)
 
Upvote 0
I got in a hurry, thanks Fluff

=IF(AND(CODE(RIGHT(D2,1))>64,CODE(RIGHT(D2,1))<91),LEFT(D2,LEN(D2)-1),D2)
 
Upvote 0
If we knew the OP had office 360, I would use the LET function to shorten that
 
Upvote 0
The CODE version could be shortened to this:
=LEFT(A1,LEN(A1)-AND(CODE(RIGHT(A1))>64,CODE(RIGHT(A1)<91)))
 
Upvote 0

Forum statistics

Threads
1,224,812
Messages
6,181,084
Members
453,021
Latest member
Justyna P

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