Discussion Locked

How can I truncate TEXT in Excel 97?

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I had a user ask me how he can truncate text which he imports from the internet. The data goes into a cell with column width set at 20, but some of the cells have quite lengthy and variable text, such as a complete sentence. He only needs a portion of the text, say, up to what fits in column width 20. I know Excel has a function to truncate numerical data, but I can't find a function to truncate text. I wrote an if statement that checks the length of the cell's value and replaces all but the first 10 characters with blanks. Then he can copy and paste only the values from the 'working' column to the needed column. (FYI, This worksheet is uploaded to a mainframe file so it is critical that the data be massaged to fit the mainframe record layout.)

3 replies

by peyison

To truncate text, use the mid() function:

=MID(A1,1,20)

first parameter is the cell, second is the starting point of the string, third is the length to return

Hope this helps.

This discussion is closed to new replies.