Search code examples
excelexcel-formulaworksheet-function

Character count and then Trim


I know how to count number of characters in Excel using

=LEN(A1)

My question is if the character length count is greater then 3000 it should trim all the data that is above 3000, is it possible in Excel?


Solution

  • You can use the LEFT() function to achieve that. As pnuts kindly points out in the comments, we actually don't have to check with LEN() first if the cell's length is bigger than 3000 characters, we can use the LEFT() function immediately:

    =LEFT(A1, 3000)
    

    where A1 is the cell you need to shorten if it is too long.