Data Cleaning: Strip A Trailing Comma, Period Or Semicolon

Excel Formulas › Data Cleaning

All versions

Imported lists often end with stray punctuation. TRIM removes extra spaces, then FIND checks whether the last character is a comma, period or semicolon, and LEFT drops it.


Quick formula: Trim, test the last character, and drop it if punctuation:
=IF(ISNUMBER(FIND(RIGHT(TRIM(B2),1),",.;")),LEFT(TRIM(B2),LEN(TRIM(B2))-1),TRIM(B2))

"Acme Plumbing," becomes "Acme Plumbing".

Functions used (tap for the full reference guide):

The example

Three values: one with a comma, one with a period and extra spaces, one already clean.

ABCD
1CaseTextCleanedLength
2Row 1Acme Plumbing,Acme Plumbing13
3Row 2 Smith and Sons. Smith and Sons14
4Row 3Delta AirDelta Air9

The formula

The last character is looked up in a short list of punctuation marks:

=IF(ISNUMBER(FIND(RIGHT(TRIM(B2),1),",.;")),LEFT(TRIM(B2),LEN(TRIM(B2))-1),TRIM(B2)) // cleaned text; length = LEN(cleaned)

How it works

Here is the logic, one piece at a time:

  1. TRIM(B2) removes extra spaces.
  2. RIGHT(...,1) grabs the last character.
  3. FIND checks if it is in ",.;" and ISNUMBER turns that into TRUE or FALSE.
  4. LEFT(...,LEN-1) removes it; otherwise the trimmed text is returned.

Run the cleaned column through Paste Special Values before deleting the original.

Try it: interactive demo

Interactive

Type a value with trailing punctuation.

Variations

More characters

Add them to the list.

=IF(ISNUMBER(FIND(RIGHT(TRIM(B2),1),",.;:")),LEFT(TRIM(B2),LEN(TRIM(B2))-1),TRIM(B2))

Remove all

Loop with SUBSTITUTE.

=SUBSTITUTE(B2,",","")

Pitfalls & errors

An empty cell makes FIND return 1 and LEFT error; wrap in IF(B2="","",...).

Only one trailing character is removed.

Keep the original column until checked.

Practice workbook

📊
Download the free Data Cleaning: Strip A Trailing Comma, Period Or Semicolon practice workbook
Edit the yellow text cells; the cleaned value and length recalculate.

Frequently asked questions

Why FIND and not SEARCH?
FIND is case-sensitive and takes no wildcards, safer here.
Several trailing marks?
Repeat or use a LAMBDA.

Stop fighting formulas. Learn them in a day.

This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related formulas: Standardize Phone Number Format · Truncate Long Text with an Ellipsis · Build a Normalized Match Key

Function references: TRIMRIGHTLEFTFINDLENISNUMBER