How to Remove Last/First Character if it is a Comma or Certain Character in Excel?


The spreadsheet tool Excel is effective for managing, analysing, and calculating data. When working with data, you could occasionally encounter circumstances where you need to clean up your data by removing specific characters, like commas or other unwanted symbols, from the beginning or end of a cell's content.

In this tutorial, we'll walk you through each step of how to execute this task utilising fundamental Excel formulas and functions. By the end of this course, you will be able to consistently clean up your data, ensuring that it is in the desired format and ready for additional analysis.

Remove Last/First Character if it is a Comma or Certain Character

Here we will get the first result using the formula, then use the autofill hand to complete the task. So let us see a simple process to know how you can remove the last or first character if it is a comma or certain character in Excel.

Step 1

Consider an Excel sheet where you have a list of text strings similar to the below image.

First, to remove the last character if it is a comma, click on an empty cell and enter the formula as =IF(RIGHT(A2,1)=",",LEFT(A2,LEN(A2)-1),A2) and click enter to get the first value. Then drag down using the autofill handle.

Empty Cell > Formula > Enter > Drag.

Step 2

Then, to remove the first character if it is a comma, click on an empty cell and enter the formula as =IF(LEFT(A2,1)=",",RIGHT(A2,LEN(A2)-1),A2) and drag down using the autofill handle.

Empty Cell > Formula > Enter > Drag.

This is how you can remove the last character if it is a command in Excel.

Note  Removal from a certain position is not possible. Try to do it manually.

Conclusion

In this tutorial, we have used a simple example to demonstrate how you can remove the last or first character if it is a comma or a certain character in Excel to highlight a particular set of data.

Updated on: 08-Sep-2023

622 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements