Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 25
Default Left, Right & If Function

I have a set of names that all have a different number of letters. Some have
a middle initial (at the end of the word). I'm wondering if there is a way
with a formula that I can cut off the middle intial in the data set. Example:

Sanders, Frank A.
Smith, Tom B.
Jobs, Steve

I would want the formula to recongnize the last period (A.) or the (B.) even
though the words are different lengths. Also there are some people that do
not have middle initials that I'd want to include. Verbally this is what I'm
thinking.

=IF(the name ends in a period(then cut off A. 3 digits to eliminate the
space prior to the middle initial, IF it doesn't end in a period then return
the full name).

Thanks in advance!


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Left, Right & If Function

Try the following with the name in A1.

=IF(RIGHT(A1,1)=".",LEFT(A1,LEN(A1)-3),A1)


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



"Darin" wrote in message
...
I have a set of names that all have a different number of letters. Some
have
a middle initial (at the end of the word). I'm wondering if there is a
way
with a formula that I can cut off the middle intial in the data set.
Example:

Sanders, Frank A.
Smith, Tom B.
Jobs, Steve

I would want the formula to recongnize the last period (A.) or the (B.)
even
though the words are different lengths. Also there are some people that
do
not have middle initials that I'd want to include. Verbally this is what
I'm
thinking.

=IF(the name ends in a period(then cut off A. 3 digits to eliminate the
space prior to the middle initial, IF it doesn't end in a period then
return
the full name).

Thanks in advance!



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Left, Right & If Function

So the middle initial is always preceded by a space and followed by a period?

If yes to both:

=IF(COUNTIF(A1,"* ?.")=0,A1,LEFT(A1,LEN(A1)-3))

* is a wild card that represents any set of characters.
? is a wild card that represents any one character.

So "* ?." is looking in A1 for a bunch of characters followed by a space, then a
single character (any character) followed by a period.



Darin wrote:

I have a set of names that all have a different number of letters. Some have
a middle initial (at the end of the word). I'm wondering if there is a way
with a formula that I can cut off the middle intial in the data set. Example:

Sanders, Frank A.
Smith, Tom B.
Jobs, Steve

I would want the formula to recongnize the last period (A.) or the (B.) even
though the words are different lengths. Also there are some people that do
not have middle initials that I'd want to include. Verbally this is what I'm
thinking.

=IF(the name ends in a period(then cut off A. 3 digits to eliminate the
space prior to the middle initial, IF it doesn't end in a period then return
the full name).

Thanks in advance!


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MID function from right to left nsv Excel Worksheet Functions 4 May 8th 23 11:41 AM
How to nest a left function within a sumif function? LisaK Excel Worksheet Functions 2 April 23rd 23 11:46 AM
Help with LEFT function Cam Excel Discussion (Misc queries) 5 October 15th 07 07:32 PM
Left vs Left$ function Andy Excel Discussion (Misc queries) 5 May 6th 07 04:06 AM
HOW DO I NEST THE VLOOKUP FUNCTION WITH THE LEFT FUNCTION CHAIM Excel Worksheet Functions 1 July 27th 05 09:10 PM


All times are GMT +1. The time now is 02:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"