Nested RIGHT function not cutting off "A " or "An " but works for "The " ?

heliacalTexan

New Member
Joined
Jun 21, 2015
Messages
1
I'm trying to keep a list of titles in alpha order that disregards opening articles (A, An, The), but will still allow the full title to be displayed in another column. (E.g., "The Addams Family" displays in one, but gets shortened to "Addams Family" in the other.)

The display part I've taken care of with a hidden "helper" column. The formula I'm using the lob off the articles works for "The " but won't return correctly for "A " or "An ". Is there something specific to the RIGHT function that doesn't like the letter A?

Does it have anything to do with my "helper column" being column A?

The formula that works correctly removes The, but not A or An, and returns the shortened title is:
=IF(LEFT(B22,2)="A ",RIGHT(B22,LEN(B22)-2),IF(LEFT(B22,3)= "An ",RIGHT(B22,LEN(B22)-3),IF(LEFT(B22,4)="The ",RIGHT(B22, LEN(B22)-4),B22))
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
This works for me: =IF(LEFT(B22,2)="A ",RIGHT(B22,LEN(B22)-2),IF(LEFT(B22,3)="An ",RIGHT(B22,LEN(B22)-3),IF(LEFT(B22,4)="The ",RIGHT(B22,LEN(B22)-4),B22)))
 
Upvote 0
Here's another for what it's worth.

Code:
=IF(OR(LEFT(B22,2)="A ",LEFT(B22,3)="An ",LEFT(B22,4)="The "),TRIM(MID(SUBSTITUTE(B22," ","   "),4,99)),B22)
 
Upvote 0
For me your version also works, but you may give a try to this shorter formula:

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE("#"&B22,"#The ",""),"#A ",""),"#An ",""),"#","")
 
Upvote 0

Forum statistics

Threads
1,213,562
Messages
6,114,326
Members
448,564
Latest member
ED38

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