Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
ELS
 
Posts: n/a
Default Format text in cell from XY to X-Y

Hi all,
I have a bunch of cells in a column with two letters. I want to put a dash
(-) inbetween these two letters. Does anyone know how I can do that?? Please
help!
(These are for initials, so, i want to add a dash in place of a middle
initial for those initials that were entered with only two characters.)
So, basically, I want to format the column so that when there are only 2
characters in a cell, a dash will be inserted in the middle. When there are
3 characters in the cell, they will be left alone.

thanks!
--
ELS
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Format text in cell from XY to X-Y

You can't do this with formatting, but you can use another column with formulas
like:

=if(len(a2)<2,a2,left(a2,1)&"-"&right(a2,1))

ELS wrote:

Hi all,
I have a bunch of cells in a column with two letters. I want to put a dash
(-) inbetween these two letters. Does anyone know how I can do that?? Please
help!
(These are for initials, so, i want to add a dash in place of a middle
initial for those initials that were entered with only two characters.)
So, basically, I want to format the column so that when there are only 2
characters in a cell, a dash will be inserted in the middle. When there are
3 characters in the cell, they will be left alone.

thanks!
--
ELS


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
ELS
 
Posts: n/a
Default Format text in cell from XY to X-Y

Hi Dave!
You are awesome! Thank you! There's only one problem, when i drag that
formula down the column, the result for the cases that have 3 characters
shows up as a number. So, for example
Orignal column/formatted column
AB/A-B
ABC/380

Do you know of anything to add to the formula so that the result for cells
with 3 characters would be the same 3 characters?

Thanks!
--
ELS


"Dave Peterson" wrote:

You can't do this with formatting, but you can use another column with formulas
like:

=if(len(a2)<2,a2,left(a2,1)&"-"&right(a2,1))

ELS wrote:

Hi all,
I have a bunch of cells in a column with two letters. I want to put a dash
(-) inbetween these two letters. Does anyone know how I can do that?? Please
help!
(These are for initials, so, i want to add a dash in place of a middle
initial for those initials that were entered with only two characters.)
So, basically, I want to format the column so that when there are only 2
characters in a cell, a dash will be inserted in the middle. When there are
3 characters in the cell, they will be left alone.

thanks!
--
ELS


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
ELS
 
Posts: n/a
Default Format text in cell from XY to X-Y

Hi Again Dave,
Please ignore my last question.
I just realized on the formula I was referrening the wrong cell. So, that's
why i got 3 numbers as a result, instead of the 3 characters.

Thanks again for your help!!!
I really appreciate it!!!
--
ELS


"Dave Peterson" wrote:

You can't do this with formatting, but you can use another column with formulas
like:

=if(len(a2)<2,a2,left(a2,1)&"-"&right(a2,1))

ELS wrote:

Hi all,
I have a bunch of cells in a column with two letters. I want to put a dash
(-) inbetween these two letters. Does anyone know how I can do that?? Please
help!
(These are for initials, so, i want to add a dash in place of a middle
initial for those initials that were entered with only two characters.)
So, basically, I want to format the column so that when there are only 2
characters in a cell, a dash will be inserted in the middle. When there are
3 characters in the cell, they will be left alone.

thanks!
--
ELS


--

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
Urgent date/scheduling calc needed jct Excel Worksheet Functions 3 February 24th 06 01:36 AM
Changing cell format - for example text to numeric sjrku Excel Discussion (Misc queries) 3 December 30th 05 10:40 PM
Cell Format - $ and Text Minitman Excel Worksheet Functions 0 November 30th 05 04:41 PM
How to change default cell format to "Text" rbecerra Excel Discussion (Misc queries) 2 September 10th 05 04:29 AM
16 digit number wont keep alteration unless format cell to text Croc001 Excel Discussion (Misc queries) 3 March 30th 05 09:12 AM


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