---
title: Ghostbusting Spaces in Minitab
description: Ghostbusting Spaces in Minitab
---

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

# [Ghostbusting Spaces in Minitab](https://blog.minitab.com/en/blog/statistics-and-quality-improvement/ghostbusting-spaces-in-minitab)

 Written by [Cody Steele](https://blog.minitab.com/en/blog/author/cody-steele) | Jul 8, 2015, 4:00:00 AM

It’s been almost 5 years since I used a quotation from *Ghostbusters* to introduce one of [my early blog posts](https://blog.minitab.com/blog/statistics-and-quality-improvement/strangers-with-candy-scary-statistics-with-candy-great?hsLang=en). But as we’re getting [a few bits of entertainment news](https://twitter.com/hashtag/whatyougonnashoot) about the next installment in the [*Ghostbusters*](http://www.ghostbusters.com)franchise, I thought it might be a good time to talk about busting ghosts in Minitab.

In the Minitab sense, ghosts are spaces that are in your data that you can’t see. The busting action is slightly different for text data and numeric data.

## Remove Spaces from Text Data

Let’s look at text data first. Let’s say that you have data that look like this:

It *looks* like the same value repeated over and over again. It *looks* like there’s nothing there but the word “Ghostbusters.”

This is the moment where you get your PKE meter out. Or rather, this is where you tally your data to see what's going on. That moment’s going to be like this:

1. Choose **Stat \> Tables \> Tally Individual Variables**.
2. In **Variables**, enter *Title*. Click **OK**.

The count of the single word should be the same as the number of rows in the data. It’s not. There are ghosts there that you can’t see.

**Tally for Discrete Variables: Title**

   
                       Title  Count  
                Ghostbusters      5  
               Ghostbusters       6  
              Ghostbusters        7  
             Ghostbusters         5  
            Ghostbusters          8  
           Ghostbusters           9  
          Ghostbusters            5  
         Ghostbusters             7  
        Ghostbusters              3  
       Ghostbusters               4  
      Ghostbusters               11  
     Ghostbusters                 8  
    Ghostbusters                  8  
   Ghostbusters                   7  
  Ghostbusters                    5  
 Ghostbusters                     2  
                          N=    100

Tally, standing in for your PKE meter, shows a stairstep pattern because of the extra spaces at the end of the word. Extra spaces that you can't see in the data window unless you highlight a cell.

One way to fix the problem would be to go through the data window clicking on the individual cells to find the ones with extra spaces to delete. Fortunately, Minitab gives you a better way to make all of these values the same. You can use the calculator function TRIM:

1. Choose **Calc \> Calculator**.
2. In **Store Result in Variable**, enter *Title2*.
3. In **Expression**, enter *Trim(Title)*. Click **OK**.

If you tally the new values, you get the result you expect when all of the values are the same:

**Tally for Discrete Variables: Title2**

      Title2  Count  
 Ghostbusters    100  
           N=    100

All those ghosts are in the trap, not in your data.

## Remove Spaces from Numeric Data

If you wanted, you could trim a series of numbers to eliminate spaces, but a bigger problem remains unsolved. For example, if you paste some numbers formatted as text from Excel, you might get a column like this:

These numbers *look* like numbers. It doesn’t *look* like there are extra spaces that you can’t see, but the spaces are there. We can see them if we tally them:

**Tally for Discrete Variables: Numbers**  
Numbers  Count  
       9     55  
      9       8  
     9       11  
    9        10  
   9          8  
  9           8  
      N=    100

But the column is also formatted as text. That’s what the “–T” next to the C9 means in the worksheet. If we want to analyze the numbers, find the mean or create a scatterplot, then we need the numbers to be formatted as numbers. If we use the TRIM function, the numbers will still be text. For this, we’re going to have to use something a little bit stronger:

No, not crossing the streams. (Egon said that crossing the streams was *bad*.) Instead, we change the column format.

1. Put the cursor in the column of numbers.
2. Right-click and select **Format Column**.
3. In Choose type, select **Automatic numeric**.
4. Click **OK**.

**Tally for Discrete Variables: Numbers**  
Numbers  Count  
       9    100  
      N=    100

In one step, you’ve converted the format of the column and eliminated the extra spaces. The ghosts are all gone.

## Wrap-up

If you have to work with data, especially data that someone types, then you’re going to have to deal with messy data. The TRIM function and the ability to change column formats are two tools that Minitab gives you to get the ghosts out of your data.

Have other problems? Minitab has lots of other tools to simplify the cleaning that you’ll need to do for your data. If you’re ready for a few more tricks, check out [3 Ways to Clean Up Data So You Can Promote Public Dialog](https://blog.minitab.com/blog/statistics-and-quality-improvement/3-ways-to-clean-up-data-so-you-can-promote-public-dialog?hsLang=en) and [3 Features to Make You Glad You're You When You Have to Clean Data in Minitab](https://blog.minitab.com/blog/statistics-and-quality-improvement/done-cancel?hsLang=en#comment-2075244629).

 

[Ghostbusters](http://www.ghostbusters.com)*images: TM & © 2014 Columbia Pictures Industries Inc.* 

[View full post](https://blog.minitab.com/en/blog/statistics-and-quality-improvement/ghostbusting-spaces-in-minitab)

```json
{
  "@context" : "http://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Cody Steele"
  },
  "dateModified" : "2025-07-05T23:05:41.817Z",
  "datePublished" : "2015-07-08T04:00:00Z",
  "headline" : "Ghostbusting Spaces in Minitab",
  "image" : {
    "@type" : "ImageObject",
    "height" : 299,
    "url" : "https://3447555.fs1.hubspotusercontent-na1.net/hubfs/3447555/B2BML%20-%20NEW%20FILE%20MANAGER%20STRUCTURE/Blog%20Images/Imported_Blog_Media/ghostbusters_trap-Jul-05-2025-10-59-03-2574-PM.jpg",
    "width" : 448
  },
  "mainEntityOfPage" : "https://blog.minitab.com/en/blog/statistics-and-quality-improvement/ghostbusting-spaces-in-minitab",
  "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"
  }
}
```