---
title: How to Remove Leading or Trailing Spaces from a Data Set
description: How to Remove Leading or Trailing Spaces from a Data Set
---

[Minitab Blog](https://blog.minitab.com/en/blog)

# [How to Remove Leading or Trailing Spaces from a Data Set](https://blog.minitab.com/en/blog/michelle-paret/how-to-remove-leading-or-trailing-spaces-from-a-data-set)

 Written by [Minitab Blog Editor](https://blog.minitab.com/en/blog/author/minitab-blog-editor) | Mar 25, 2016 4:00:00 AM

Leading and trailing spaces in a data set are like termites in your house. If you don’t realize they are there and you don’t get rid of them, they’re going to wreak havoc.

Here are a few easy ways to remove these pesky characters with [Minitab Statistical Software](http://www.minitab.com/products/minitab/)  prior to analysis.

## Data Import

If you’re importing data from Excel, a text file, or some other file type:

1. Choose **File > Open** and select your Excel file, text file, etc.
2. Click **Options** and select *Remove nonprintable characters and extra spaces*.
3. Click **OK**.

## The Calculator

Suppose you already have your data in Minitab, located in column C1:

1. Choose **Calc > Calculator**.
2. In **Store result in variable**, enter a blank column (e.g. *C5*), or you can overwrite an existing column.
3. In **Expression**, enter *TRIM(C1).*
4. Click **OK**.

If you also want to remove all non-printable characters using the Calculator, *CLEAN* is available as well.

And that’s all there is to it.

[View full post](https://blog.minitab.com/en/blog/michelle-paret/how-to-remove-leading-or-trailing-spaces-from-a-data-set)

```json
{
  "@context" : "http://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Minitab Blog Editor"
  },
  "dateModified" : "2025-07-05T23:43:12.909Z",
  "datePublished" : "2016-03-25T04:00:00Z",
  "headline" : "How to Remove Leading or Trailing Spaces from a Data Set",
  "image" : {
    "@type" : "ImageObject",
    "height" : 184,
    "url" : "https://3447555.fs1.hubspotusercontent-na1.net/hubfs/3447555/B2BML%20-%20NEW%20FILE%20MANAGER%20STRUCTURE/Blog%20Images/Imported_Blog_Media/keyboard-3.jpg",
    "width" : 274
  },
  "mainEntityOfPage" : "https://blog.minitab.com/en/blog/michelle-paret/how-to-remove-leading-or-trailing-spaces-from-a-data-set",
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "height" : 60,
      "url" : "/hs/hsstatic/content_shared_assets/static-1.4092/img/default-amp-logo.png",
      "width" : 60
    },
    "name" : "Minitab Blog"
  }
}
```