Searching and Manipulating Data in Excel
Apr 1, 2020 • 12 Minute Read
Introduction
In today's world numbers are present in every domain, be it accounting, education, agriculture, etc. People working in domains related to computers are known to use sophisticated tools. However, Excel comes in very handy for even non-technical users if they need to perform basic calculations or maintain records.
This guide will go over how to search and manipulate data in Excel and cover topics such as:
- Changing the text case
- Sorting and filtering data
- Combining data using the concatenate function
- Pasting data into cells
- Find and replace
Changing Text Case in Excel
You may get text in your spreadsheet in any format. To change the text case in Excel, first consider these records:
Statements |
---|
Microsoft Excel is a spreadsheet developed by Microsoft for Windows, macOS, Android and iOS. |
It features calculation, graphing tools, pivot tables, and a macro programming language called Visual Basic for Applications. |
Microsoft Excel has the basic features of all spreadsheets. |
Excel forms part of the Microsoft Office suite of software. |
As you can observe in the above table, all the statements begin with a capital letter (the exception being keywords like Windows, Android, etc.) and the rest of the words are in lowercase. This guide will explain how to perform changes to the text.
You'll start with the PROPER function, which converts first letter of all the words into uppercase as shown:
=PROPER(select_cells)
*Output:
Statements |
---|
Microsoft Excel Is A Spreadsheet Developed By Microsoft For Windows, Macos, Android And Ios. |
It Features Calculation, Graphing Tools, Pivot Tables, And A Macro Programming Language Called Visual Basic For Applications. |
Microsoft Excel Has The Basic Features Of All Spreadsheets. |
Excel Forms Part Of The Microsoft Office Suite Of Software. |
Next, there are two other functions: LOWER and UPPER. The implementation along with their results has been shown below:
=LOWER(select_cells)
Output:
Statements |
---|
microsoft excel is a spreadsheet developed by microsoft for windows, macos, android and ios. |
it features calculation, graphing tools, pivot tables, and a macro programming language called visual basic for applications. |
microsoft excel has the basic features of all spreadsheets. |
excel forms part of the microsoft office suite of software. |
=UPPER(select_cells)
Output:
Statements |
---|
MICROSOFT EXCEL IS A SPREADSHEET DEVELOPED BY MICROSOFT FOR WINDOWS, MACOS, ANDROID AND IOS. |
IT FEATURES CALCULATION, GRAPHING TOOLS, PIVOT TABLES, AND A MACRO PROGRAMMING LANGUAGE CALLED VISUAL BASIC FOR APPLICATIONS. |
MICROSOFT EXCEL HAS THE BASIC FEATURES OF ALL SPREADSHEETS. |
EXCEL FORMS PART OF THE MICROSOFT OFFICE SUITE OF SOFTWARE. |
Sorting and Filtering Data in Excel
Consider a data set from UCI Machine Learning Repository named Abalone. The first 10 rows of the data set will be used to teach you how to perform sorting and filtering of data in Excel.
Gender | Length | Diam | Height | Whole | Shucked | Viscera | Shell | Rings |
---|---|---|---|---|---|---|---|---|
M | 0.455 | 0.365 | 0.095 | 0.514 | 0.2245 | 0.101 | 0.15 | 15 |
M | 0.35 | 0.265 | 0.09 | 0.2255 | 0.0995 | 0.0485 | 0.07 | 7 |
F | 0.53 | 0.42 | 0.135 | 0.677 | 0.2565 | 0.1415 | 0.21 | 9 |
M | 0.44 | 0.365 | 0.125 | 0.516 | 0.2155 | 0.114 | 0.155 | 10 |
I | 0.33 | 0.255 | 0.08 | 0.205 | 0.0895 | 0.0395 | 0.055 | 7 |
I | 0.425 | 0.3 | 0.095 | 0.3515 | 0.141 | 0.0775 | 0.12 | 8 |
F | 0.53 | 0.415 | 0.15 | 0.7775 | 0.237 | 0.1415 | 0.33 | 20 |
F | 0.545 | 0.425 | 0.125 | 0.768 | 0.294 | 0.1495 | 0.26 | 16 |
M | 0.475 | 0.37 | 0.125 | 0.5095 | 0.2165 | 0.1125 | 0.165 | 9 |
F | 0.55 | 0.44 | 0.15 | 0.8945 | 0.3145 | 0.151 | 0.32 | 19 |
The following image depicts how sorting and filtering icons looks in the Excel menu bar:
The first step is to select the table and click on the Filter icon. This will bring a drop down menu icon on each of the column headers.
Let's say you want to sort these records based on the gender labels. Click on the drop-down arrow of the Gender column and select Sort A to Z. This will result in the following table:
Gender | Length | Diam | Height | Whole | Shucked | Viscera | Shell | Rings |
---|---|---|---|---|---|---|---|---|
F | 0.53 | 0.42 | 0.135 | 0.677 | 0.2565 | 0.1415 | 0.21 | 9 |
F | 0.53 | 0.415 | 0.15 | 0.7775 | 0.237 | 0.1415 | 0.33 | 20 |
F | 0.545 | 0.425 | 0.125 | 0.768 | 0.294 | 0.1495 | 0.26 | 16 |
F | 0.55 | 0.44 | 0.15 | 0.8945 | 0.3145 | 0.151 | 0.32 | 19 |
I | 0.33 | 0.255 | 0.08 | 0.205 | 0.0895 | 0.0395 | 0.055 | 7 |
I | 0.425 | 0.3 | 0.095 | 0.3515 | 0.141 | 0.0775 | 0.12 | 8 |
M | 0.455 | 0.365 | 0.095 | 0.514 | 0.2245 | 0.101 | 0.15 | 15 |
M | 0.35 | 0.265 | 0.09 | 0.2255 | 0.0995 | 0.0485 | 0.07 | 7 |
M | 0.44 | 0.365 | 0.125 | 0.516 | 0.2155 | 0.114 | 0.155 | 10 |
M | 0.475 | 0.37 | 0.125 | 0.5095 | 0.2165 | 0.1125 | 0.165 | 9 |
The records with label F (Female) will appear at the top of the list, followed by I (Infant) and M (Male). If you just want the records corresponding to Females, unselect all and then select the label F under the Gender drop-down menu. That will result in the following table:
Gender | Length | Diam | Height | Whole | Shucked | Viscera | Shell | Rings |
---|---|---|---|---|---|---|---|---|
F | 0.53 | 0.42 | 0.135 | 0.677 | 0.2565 | 0.1415 | 0.21 | 9 |
F | 0.53 | 0.415 | 0.15 | 0.7775 | 0.237 | 0.1415 | 0.33 | 20 |
F | 0.545 | 0.425 | 0.125 | 0.768 | 0.294 | 0.1495 | 0.26 | 16 |
F | 0.55 | 0.44 | 0.15 | 0.8945 | 0.3145 | 0.151 | 0.32 | 19 |
Combining Data Using the Concatenate Function
Suppose you have a data set such as as the one given below:
First | Last | Degree |
---|---|---|
Alice | Johnson | MD |
Peter | Rottingum | MBBS |
James | Teal | PhD |
And you need to arrive at the given result in a new column:
Complete |
---|
Alice Johnson, MD |
Peter Rottingum, MBBS |
James Teal, PhD |
What will you do to achieve this task?
You may have to manually copy the values from a cell and paste it into the final one, not to mention the need to put the proper spacing and a comma right after the last name. To make this process easier, Excel has a function called CONCATENATE. You can use this function and complete this task in less than a minute. The syntax goes like this:
=CONCATENATE(A2, " ", B2, ", ", C2)
A proper spacing, a comma and the cell names. This results in the final column as expected.
Pasting Data into Cells
In Excel, when you copy data from one cell and try to paste it into a different cell, a lot of manipulations can be performed. For instance, in the previous section you learned how to implement the CONCATENATE function, so assume you have written the function in cell E1 and now you want to copy the result of the function into a different cell.
If you use keyboard shortcut Ctrl+V to paste, it will paste the formula, not the result itself. However, you can right click on the cell and the paste section will show a lot more options to explore. You can paste the formula itself, the result as-is, transpose the result, take care of the formatting, etc. Try to explore these options as shown in the below image:
Find and Replace
Consider the Abalone data set with 10 records. To perform a search and replace task in Excel, you can use the keyboard shortcut Ctrl+F, or you may select the entire range of options available under the icon named Find and Select present at the extreme right hand side of the menu bar.
Open the Find and Replace dialog box using the Ctrl+F keys and search for a number 0.1415. This number is present under the Viscera column. Clicking on the Find button again and again will take you through all the cells which contain this number. To replace a value once you have found it, go to the Replace tab under the same dialog box and enter the value to be found and the value it needs to be replaced with.
There's also an option for conditional formatting, where you can find cells based on certain conditions and highlight the ones which are detected. To understand this concept, take a look on the given table:
ID | Username_hash |
---|---|
854 | U_sdfh |
9842 | U_sfjje |
578 | U_ktj |
124 | U_bel |
598 | U_kel |
475 | U_bgk |
6878 | U_lqo |
6201 | U_qwn |
5477 | U_mbq |
56 | U_nflq |
So if you want to see how many user IDs are above the value 1000, select the ID column, go to Conditional Formatting, Highlight Cells Rules, and Greater Than.... Select the value 1000 and press OK.
This will highlight the 2nd (9842), 7th (6878), 8th (6201) and 9th (5477) row values.
Conclusion
In this guide, you have learned how to manipulate data in Excel at a beginner level. To learn more on the same topic, refer to the Pluralsight Searching and Manipulating Data in Excel course.