Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
jb jb is offline
external usenet poster
 
Posts: 6
Default TrailingSpaces

I use the following formula to copy the middle initial and add a . after
it. The column being copied from has the firstname and middle initial
in the cells(John H). This has been working in thepast, but now it puts
spaces between the midddle initial and . when it is copied( John
..). How can I trim the trailing from the middle initial before adding
the period.

=IF(ISERROR(FIND(" ",C124,1)),"",RIGHT(C124,LEN(C124) -FIND("
",C124,1))& ".")

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default TrailingSpaces

Hi
works for me. the entry 'John H.' will result in 'H.' without any
blanks between 'H' and '.'??
Frank

jb wrote:
I use the following formula to copy the middle initial and add a .
after it. The column being copied from has the firstname and middle
initial in the cells(John H). This has been working in thepast, but
now it puts spaces between the midddle initial and . when it is
copied( John .). How can I trim the trailing from the middle initial
before adding the period.

=IF(ISERROR(FIND(" ",C124,1)),"",RIGHT(C124,LEN(C124) -FIND("
",C124,1))& ".")

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default TrailingSpaces

Hi jb,

I'm guessing the values in your name column have one or more trailing spaces
in them. You can use the TRIM function in your formula to remedy this:

=IF(ISERROR(FIND(" ",C124,1)),"",TRIM(RIGHT(C124,LEN(C124) -FIND("
",C124,1))) & ".")


--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


jb wrote:
I use the following formula to copy the middle initial and add a .
after it. The column being copied from has the firstname and middle
initial in the cells(John H). This has been working in thepast, but
now it puts spaces between the midddle initial and . when it is
copied( John .). How can I trim the trailing from the middle initial
before adding the period.

=IF(ISERROR(FIND(" ",C124,1)),"",RIGHT(C124,LEN(C124) -FIND("
",C124,1))& ".")

Thanks


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default TrailingSpaces

On second thought, you may want to use TRIM on all references to the cell:

=IF(ISERROR(FIND("
",TRIM(C124),1)),"",RIGHT(TRIM(C124),LEN(TRIM(C124 )) -FIND("
",TRIM(C124),1)) & ".")

This will help in cases where you have trailing spaces on a first name with
no middle initial.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Jake Marx wrote:
Hi jb,

I'm guessing the values in your name column have one or more trailing
spaces in them. You can use the TRIM function in your formula to
remedy this:

=IF(ISERROR(FIND(" ",C124,1)),"",TRIM(RIGHT(C124,LEN(C124) -FIND("
",C124,1))) & ".")



jb wrote:
I use the following formula to copy the middle initial and add a .
after it. The column being copied from has the firstname and middle
initial in the cells(John H). This has been working in thepast, but
now it puts spaces between the midddle initial and . when it is
copied( John .). How can I trim the trailing from the middle initial
before adding the period.

=IF(ISERROR(FIND(" ",C124,1)),"",RIGHT(C124,LEN(C124) -FIND("
",C124,1))& ".")

Thanks


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default TrailingSpaces

Try
=IF(ISERROR(FIND("
",Trim(C124),1)),"",RIGHT(Trim(C124),LEN(Trim(C124 )) -FIND("
",Trim(C124),1))& ".")

--
Regards,
Tom Ogilvy


"jb" wrote in message
...
I use the following formula to copy the middle initial and add a . after
it. The column being copied from has the firstname and middle initial
in the cells(John H). This has been working in thepast, but now it puts
spaces between the midddle initial and . when it is copied( John
.). How can I trim the trailing from the middle initial before adding
the period.

=IF(ISERROR(FIND(" ",C124,1)),"",RIGHT(C124,LEN(C124) -FIND("
",C124,1))& ".")

Thanks





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



All times are GMT +1. The time now is 02:49 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"