
If we want to get the total numbers of spaces in a cell, we can use a substitute formula with the LEN function.Īs I remember above, we have used the trim function with a LEN function for extra spaces count. Note: This function returns the count of extra spaces in a cell, but this function will be not useful as we want to count with a single space also or spaces in the middle of text because trim removed only the unwanted spaces. The following screenshot shows the above formula in action: If you want to get the total numbers of extra spaces in a cell, then, first of all, we find the total numbers of text length using the Len function, then calculate the string length without extra spaces and subtract the latter from the total length.
Then you need to copy and paste values only, not formulas like in the first example.Įxplanation of the TRIM Function in Excelīefore removing spaces in data, if we want to know how much extra space or total space in the excel sheet, we get the LEN function’s help with a trim function. Select the range and fill down the column with the formula. The cursor Position to the lower right corner of the formula cell (B16 in this example). So now we can use a trim function with a clean function. Example showing as below mention pictures. So we can use a trim function with a clean function for such type situations. Normally when we fetch data in excel from another application or any database like SQL Server, Oracle, HTML, we face such type issue for line breaking with extra space we can say that double line issue or wrap text issue, and also ever include with a special character which is not removed with only trim. Press the Enter, and the result will look like. And Paste the data as value only, not a formula you can also use a shortcut method for paste special, (Ctrl+Alt+V). Select all cells with the original data (A2:A12). Select all cells with Trim formulas (B2:B12 in this example), and copy (CTRL+C) the selected range. So such type of this happen, you need to copy only values, not formulas, Steps are below mention. Now, replace the values in the original column with the trimmed data value, But be careful, simply copy and paste the trimmed column data value over the original column otherwise, destroy your formulas, and we also we lost the data. As a result, you will have 2 columns of original names with spaces and formula trimmed customers’ names. Select the range (B2:B12) and fill down the formula, up to the last cell with data. A position of the cursor to the lower right corner of the formula cell (B2 in this example),.
Write a TRIM formula for the first-row cell, A2, in our example:.
#EXCEL TRUNCATE CURRENCY COMPARE HOW TO#
Let us now see how to use the TRIM function in Excel with the help of some examples. Trim Function in Excel is very simple and easy to use. Put the Cell value or text value where you want to remove space from data. Then we have to enter the details as shown in the picture.We get a new function window showing in below mention pictures.Also, click on the function icon, then manually write and search the formula.Click on formula tab > Text > click on Trim.= Trim(Cell Value / Text) Steps for using the Trim function in Excel There is only one argument in the Trim function, which is below mention.Ĭlick on the cell where you want to result in value then put the formula as below mention Excel functions, formula, charts, formatting creating excel dashboard & others