TRIM function is categorized under the Excel text function and is used to remove extra spaces from the data provided and thus, keeps the worksheet clean. Yes, you can use the TRIM function for subtracting texts of one cell from another cell in MS Excel.