MrExcel Publishing
Your One Stop for Excel Tips & Solutions

text cell problem

Posted by tim on July 31, 2001 7:03 AM

I'm trying to find a way to restrict a text cell's length. Specifically I have three columns that I concatenate to produce a fourth column yet when I can't seem to limit the number of characters in a text cell. Here's an example:

001 000001 abcdefgh 001-000001-abcdefgh

In column D I'd like to find a way to limit the total number of characters so that my final product looks like this: 001-000001-abc

I'm not sure if I should take column C and edit the data prior to concatenation or if its possible to create a format string that only prints the desired product despite having more text in the cell than is printed.

Any assistance you could offer would be greatly appreciated.

Posted by IML on July 31, 2001 7:37 AM

You could try

Assuming you always want all of A & B, and just the first three character of C.
If you are looking for different result, please explain a little more as to what you are looking for and possible entries into A, B, and C.

Good luck

Posted by tim on July 31, 2001 8:41 AM

Thanks so much for the tip! Much easier than concatenation.

Posted by Mark W. on July 31, 2001 9:05 AM

That was concatenation! Ampersand (&) is the
concatenation operator.

Posted by IML on July 31, 2001 9:44 AM

As mark says, you'll get them same results with...
if you wish.