cell alignment

J

Jerry

Greetings -

I have data like this -

11 - 4
6 - 6
118 - 6
2 - 10

I have it centered in the cells but since each string is a
different lenght the data is not aligned. How can I align
the data centered on the hyphen?

11 - 4
6 - 6
118 - 6
2 - 10

I hope that second example set posts correctly.(aligned)

Thank you
 
J

Jerry

P.S. -

Each string is a value returned by a formula. Breaking the
string up into seperate cells is not an option.
 
D

Dave Peterson

I think you'll need a helper cell. If you can put your data in one column (say
A) and a formula in another (say B), it might work ok--then hide column A.

I put this in B1

=REPT("x",6-SEARCH("-",A2))&A2&REPT("x",6-1-(LEN(A2)-SEARCH("-",A2)))

Change the lower case x's to plain old spaces once you see what's happening.

And you'll need a non-proportional font--I like "Courier New"

I chose 6 to handle up to strings with 4 digits on either side of the dash:

1234 - 5678

If you need larger numbers, increase that 6 (in both spots!)

This is what I got with your test data:

xx11 - 4xxx
xxx6 - 6xxx
x118 - 6xxx
xxx2 - 10xx

Before I changed the x to space.
 
Top