ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Format text in cell from XY to X-Y (https://www.excelbanter.com/excel-discussion-misc-queries/84927-format-text-cell-xy-x-y.html)

ELS

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

Dave Peterson

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

ELS

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


ELS

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



All times are GMT +1. The time now is 12:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com