How to Remove First Comma From Text String in Excel?


You may occasionally get across scenarios in Excel while working with data when you need to edit text to achieve the required format. The removal of the initial comma from a text string is a frequent operation. This tutorial will teach you how to delete the first comma from the Excel test text. Excel offers straightforward yet effective tools to carry out these text operations, whether you're working with a list of names, addresses, or any other type of text data. Make sure you have a fundamental understanding of Excel and its features before we start. Let's get started and discover how to manage text manipulation chores in Excel effectively!

Remove First Comma From Text String

Here we will first create a user-defined function using the VBA module, then use the formula to complete the task. So let us see a simple process to learn how you can remove the first comma from a text string in Excel.

Step 1

Consider an Excel sheet where you have a list of values separated by commas, similar to the below image.

First, right-click on the sheet name and select View code to open the VBA application.

Right-click > View Code.

Step 2

Then click on Insert and select Module, then copy the below code into the text box.

Insert > Module > Copy.

Code

Function RemoveCommaInQuotation(xStr As String)
   RemoveCommaInQuotation = WorksheetFunction.Substitute(xStr, ",", "", 1)
End Function

Step 3

Then close the VBA using Alt + Q, click on an empty cell and enter the formula as =RemoveCommaInQuotation(A2) and click enter to get the first value. Then drag down using the autofill handle.

Empty Cell > Formula > Enter > Drag.

Conclusion

In this tutorial, we have used a simple example to demonstrate how you can remove the first comma from a text string in Excel to highlight a particular set of data.

Updated on: 07-Sep-2023

103 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements