ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   fill or truncate to a certain number of characters in a cell (https://www.excelbanter.com/excel-worksheet-functions/17933-fill-truncate-certain-number-characters-cell.html)

Jan Buckley

fill or truncate to a certain number of characters in a cell
 
I need to convert cells containing text to exactly 12 characters either by
truncating or filling with spaces. Does anyone know a formula that will do
that? Thanks.

Jan Buckley

JulieD

Hi Jan

with your data in cell A2

=IF(LEN(A2)12,LEFT(A2,12),A2 & REPT(" ",12-LEN(A2)))

Cheers
JulieD

"Jan Buckley" wrote in message
...
I need to convert cells containing text to exactly 12 characters either by
truncating or filling with spaces. Does anyone know a formula that will do
that? Thanks.

Jan Buckley





All times are GMT +1. The time now is 02:58 PM.

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