Format text in cell from XY to X-Y

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!
 
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))
 
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!
 
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!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top