Join Dennis Taylor for an in-depth discussion in this video Use chart and filter for presentations, part of Excel Tips Weekly.
- [Instructor] In this worksheet called Employees Spaces, we've got some problems in column C. When you have leading spaces, that causes problems when you sort data. You might even have trailing spaces and that could cause problems if you're trying to match up data from different locations. And if you got multiple inner spaces, same problem. That occurs in row 12 here, also in row 10. We can clean up all these with a function called Trim. The Trim function is designed to get rid of spaces. Leading spaces, trailing spaces, and it will reduce multiple consecutive inner spaces to one.
If I suspect there's a trailing space, and by the way, they're really hard to track down, and usually we don't have to do this, but if I double-click in cell C2, off to the right, out this way, double-click, notice how the cursor's beyond the end of the cell. If I do this, for example, in C4, doesn't happen that way. So that's a giveaway that we've got those but let's deal with how to get rid of them. The typical approach here is to put in a new column. I'm going to right-click column D, and Insert, and simply write the formula, =trim.
Left parenthesis, C2, and I'll press Control Enter so the form is complete but the active cell stays in place. I'll double-click that lower right-hand corner, that's the fill handle. We copy these all the way down the column and you see how nicely the data's all cleaned up. And a nice, quick way to get this data into column C is to point to any edge, hold down the right mouse button, drag the data into column C, let go of that right mouse button, Copy Here as Values Only, and there we are.
And we don't need column D anymore. Right-click and delete. So, we're left with the results over here all cleaned up. And you sometimes run into these problems with formulas as well. Column F, there's a formula, and I've just double-clicked on cell F2 and we're testing here if your status is full time, that's in cell E2, and your job rating is greater than three, over here in cell J2, you get a bonus. That's certainly true here, but why isn't it true in the next row? Well, maybe there's a trailing space there.
Here, too, we might want to clean up column E. I'm simply going to double-click in cell E3 here, on the right side, there's that trailing space. Soon as I press Backspace and Enter, I cleaned that one up. But ideally, we do the same thing with the column E data like we did over with the column C data to clean that up. So, those trailing spaces really cause problems and you just don't see them unless you go to each cell, which would take forever. Now, there's a related function here called Clean. And in the next worksheet, which is called Trim Clean, we've got a situation where we're working with some data and in cell B2, I've entered data here in a way that you might not be familiar with.
I typed in 2017, I pressed Alt Enter, and then Salary, 'cause I wanted to put this in a single cell without making it so wide. In cell C2 is a formula that simple says it's equal to B2. Now, let's test. Are those equal to one another in terms of content? Here's the formula. Yes, they are. Well, I did this all over again in a different way. This I typed exactly the way I typed that one. 2017 Alt Enter Salary Enter.
And over here, I manually typed in, this is not a formula, 2017Salary. Are those equal to one another? No, they're not. So, what's the difference here? Well, the first entry has Alt Enter embedded within it. Now, when data gets copied, perhaps into Excel or across different worksheets, or maybe it has come from other software, sometimes Control characters creep in. You don't necessarily want to have to track all that down.
But in cell D4, I'm trying to clean up the data. Now, you might say, earlier, we talked about using the Trim function for spaces. We don't see any spaces here. But even if we did insert spaces, this might be a likely candidate for cleaning this up, but the Trim function doesn't do the job. It would take the Trim version of B3, that's the 2017 Salary. That doesn't help, it doesn't set up the equality. In other words, it's not equal to what we're seeing in C3. But here's the use of the Clean function.
Clean, in fact, is saying take that data in B3, take out any kind of extraneous characters, the characters we're not seeing, by the way, in this case, it's a line break. Get rid of those and then make the comparison with C3 and that's true. And by the way, in column E, I'm simply using a function called FormulaText that displays the actually formulas in the cells just to their left. So, I think of most people most of the time, when you're trying to get your data back in shape, you need to use the Trim function to deal with those unnecessary spaces.
But when you're dealing with other data, often from other sources, and you can't use Trim to clean up that data, it's the Clean function to get rid of those extraneous characters that might have crept in. Both of these are really valuable as you're trying to get your data back in shape and work with it sensibly.
Author
Updated
3/2/2021Released
1/16/2015Note: Because this is an ongoing series, viewers will not receive a certificate of completion.
Skill Level Intermediate
Duration
Views
Q: Why can't I earn a Certificate of Completion for this course?
A: We publish a new tutorial or tutorials for this course on a regular basis. We are unable to offer a Certificate of Completion because it is an ever-evolving course that is not designed to be completed. Check back often for new movies.
Related Courses
-
Excel: PivotTables for Beginners
with Dave Ludwig23m 52s Beginner -
Presentation Tips Weekly
with Jole Simmons3h 32m Intermediate -
Excel: Lookup Functions in Depth
with Dennis Taylor1h 8m Intermediate
-
Excel Tips - New This Week
-
Previous Episodes
-
Quick formatting tips8m 9s
-
Create an organization chart8m 56s
-
Auditing9m 1s
-
Adding comments and shapes7m 35s
-
Creating an Excel template7m 57s
-
Adjust banded-row formatting14m 35s
-
Dealing with circular errors8m 20s
-
Sorting tips and shortcuts8m 40s
-
Freeze Panes and Split5m 30s
-
Calculate % of change5m 41s
-
How to adjust names5m 45s
-
Sorting by moving columns4m 16s
-
Using the Solver Add-in4m 29s
-
Create picture links5m 37s
-
Display large values5m 16s
-
Create a powerful macro4m 40s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Use chart and filter for presentations