0% found this document useful (0 votes)
19 views45 pages

Unit 4 Excel

Data analytics using Excel

Uploaded by

varvalravi81
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views45 pages

Unit 4 Excel

Data analytics using Excel

Uploaded by

varvalravi81
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 45

Export Data

When you have data that needs to be transferred to another system, export it from Excel in a
format that can be interpreted by other programs, such as a text or CSV file.

1. Click the File tab.

2. At the left, click Export.


3. Click the Change File Type.
4. Under Other File Types, select a file type.
o Text (Tab delimited): The cell data will be separated by a tab.
o CSV (Comma delimited): The cell data will be separated by a comma.
o Formatted Text (space delimited): The cell data will be separated by a space.
o Save as Another File Type: Select a different file type when the Save As dialog
box appears.

The file type you select will depend on what type of file is required by the program that
will consume the exported data.

5. Click Save As.


6. Specify where you want to save the file.
7. Click Save.
A dialog box appears stating that some of the workbook features may be lost.

8. Click Yes.

Import Data

Excel can import data from external data sources including other files, databases, or web pages.

1. Click the Data tab on the Ribbon..


2. Click the Get Data button.
Some data sources may require special security access, and the connection process can
often be very complex. Enlist the help of your organization’s technical support staff for
assistance.

3. Select From File.


4. Select From Text/CSV.

If you have data to import from Access, the web, or another source, select one of those
options in the Get External Data group instead.

5. Select the file you want to import.


6. Click Import.
If, while importing external data, a security notice appears saying that it is connecting to
an external source that may not be safe, click OK.

7. Verify the preview looks correct.

Because we've specified the data is separated by commas, the delimiter is already set. If
you need to change it, it can be done from this menu.

8. Click Load.
*************************************************************************************
Cleaning data in Excel
1) Get Rid of Extra Spaces:
Extra Spaces are difficult to spot & correct. Multiple spaces may be easy, but trailing spaces are
pretty tough. Trailing spaces are blank spaces at the end of the statement or word which are not
followed by any other character.
Here’s an easy way to spot & eliminate such errors:
Syntax: TRIM(text)
Steps:

● Consider data with four cells with different spacing errors.


● Now select a column & type “TRIM(“
● Now select the cell you want to correct (in matters of spaces).
● The cell will be corrected. If there are other erroneous cells sequentially aligned, drag the fixed
cell till the point, you want to check & correct.

This easy step can save you time!

2) Select & Treat all blank cells:


Blank cells are troublesome because they often create errors while creating reports. And, people
usually want to replace such cells with 0, Not Available or something like that. But replacing
each cell manually on a large data table would take hours. Luckily, there’s an easy way to tackle
this problem.
Steps:

● Select the entire Data (you want to treat)


● Press F5 (on keyboard)
● A dialogue box will appear > Select “Special”
● Select “Blanks” & click “OK”
● Now, all blank cells will be highlighted in pale grey color, out of which one cell would be white
with a different border. That’s the active cell, type the statement you want to replace in blank
cells.
● Hit “Ctrl+Enter”

NOTE:
At the last step, if “Enter” only is pressed, then the value will be inserted only in the active cell.
So remember to press “Ctrl+Enter.”
3) Convert Numbers Stored as Text into Numbers:
When we import data from files, other sources, databases, text, etc. During transit, data might get
affected. Also, some have a habit of using an apostrophe before numerical values, which is
considered as text in Excel. Such minor data conversion can drastically affect calculations.
Suppose there are three values “70, ’70, 80”. When we compare 70 and 80 (70<80), the result is
“TRUE.” But when we compare “apostrophe 70 & 80” (‘70<80), the problem starts. Here the
result will be FALSE as the text will be rated higher than any number. To eliminate such errors,
here’s a trick.
Steps:

● Select any blank cell & type 1


● Select that cell & hit “Ctrl+C”
● Now select your data set & go to Paste > Paste Special
● In Paste Special, select “Multiply” option in the “Operation” category
● Click “OK”

Here it multiples every single value to “1”. And anything multiplied by 1 is the same number.
But this trick also takes care of the apostrophe numerical.

4) Remove Duplicates:
Elimination of duplicate data is necessary for the creation of unique data & less usage of storage.
In duplication, you can either highlight it or delete it.
A) Highlight Duplicates:

● Select the data & go to Home > Conditional Formatting > Highlight Cell Rules > Duplicate
Values
● A dialogue box will appear (Duplicate Values), Select Duplicate & formatting color
● Press OK
● All duplicate values will be highlighted!

B) Delete Duplicates:

● Select the data & go to DATA > Remove Duplicates


● A dialogue box will appear (Remove Duplicates), tick columns whose duplicates need to be
found.
● Remember to have a click on “My data has headers” (if your Data has headers) or else column
heads will be considered as data & duplication search will be applied on it too.
● Click OK!
Duplicate values will be removed! Suppose you select 4 of 4 columns. Then that four columns
rows should also match or else; they won’t be considered duplicate.

5) Highlight Errors:
While creating reports or dashboards, you might face a few arithmetical errors (like divisional
errors). Such errors are easy to spot if the Data is small. But for big data, it’s complicated. So to
get rid of such mistakes, you can go for two ways: Conditional Formatting or Go to Special.
A) Using Conditional Formatting:

● Select the Data


● Go to Home > Conditional Formatting > New Rule
● Within New Rule, Select “Format only cells that contain.”
● In Rules, Select “Errors” & Click on “Format”
● Select any color & click OK
● Hit the final “OK” button

All the cells with errors are highlighted & now are easy to spot.
B) Go to Special:

● Select the Data


● Press F5
● Click on “Special”
● A dialogue box appears (Go to Special), Select Formulas
● Now you get four options in Formulas, deselect all options except “Errors”
● Click OK! Now all errors are selected, you can delete them manually or replace a statement.
● If you wish to replace, then type the statement at active cell & hit “CTRL+ENTER.”

*************************************************************************************
Data Validation

Data Validation Example | Create Data Validation Rule | Input Message | Error Alert | Data
Validation Result
Use data validation in Excel to make sure that users enter certain values into a cell.

Data Validation Example


In this example, we restrict users to enter a whole number between 0 and 10.

Create Data Validation Rule


To create the data validation rule, execute the following steps.
1. Select cell C2.
2. On the Data tab, in the Data Tools group, click Data Validation.

On the Settings tab:


3. In the Allow list, click Whole number.
4. In the Data list, click between.
5. Enter the Minimum and Maximum values.
Input Message
Input messages appear when the user selects the cell and tell the user what to enter.
On the Input Message tab:
1. Check 'Show input message when cell is selected'.
2. Enter a title.
3. Enter an input message.
Error Alert
If users ignore the input message and enter a number that is not valid, you can show them an
error alert.
On the Error Alert tab:
1. Check 'Show error alert after invalid data is entered'.
2. Enter a title.
3. Enter an error message.

4. Click OK.

Data Validation Result


1. Select cell C2.

2. Try to enter a number higher than 10.


Result:

Note: to remove data validation from a cell, select the cell, on the Data tab, in the Data Tools
group, click Data Validation, and then click Clear All. You can use Excel's Go To Special
feature to quickly select all cells with data validation.
*************************************************************************************
Data Validation Criteria Examples
Use Data Validation to allow specific entries in cells on a worksheet. For example, show a
list, limit the cells to whole numbers, or text of specific length. This tutorial shows the
available settings, with an example of each setting.

Whole Number
If you allow Whole numbers, you can set or exclude a range of numbers, or specify a minimum
number or maximum number.
To set the allowed values, you can

1. Type the values into the Data Validation dialog box


2. OR, Refer to cells on the worksheet
3. OR, Use formulas to set the values.

For example, in this example, the MAX and MIN functions set the minimum and maximum
values, based on values in cells J5:J9.

● Minimum: =MIN(J5:J9)
● Maximum: =MAX(J5:J9)
Decimal
If you allow Decimals, you can set or exclude a range of numbers, or specify a minimum number
or maximum number.

1. Type values into the Data Validation dialog box


2. OR, Refer to cells on the worksheet
3. OR, Use formulas to set the values

In this example, values are entered for the minimum and maximum.
*************************************************************************************
How to Create Macros in Excel: Step-by-Step Tutorial (2022)
A macro is a small program or set of actions that you can run repeatedly. Excel macros are used
to automate repetitive tasks to save a lot of time and hassle.
For example, open and take a look at the practice Excel workbook.

How to record Excel macros


1. Click on the View tab in the Excel ribbon

2. Next, click on the Macros button on the right side of the View ribbon

3. This will open the Macros drop-down.


Click Record Macro.
4. Enter a name for your macro, something like Hide_Columns.
Excel macros can be stored in the Personal Macro Workbook. This is saved in the system files of
Microsoft Excel and macros saved here can be used in other workbooks.

For this Excel macro tutorial, you only need to save the macros in the current Excel file.

Kasper Langmann, Microsoft Office Specialist

4. Select Store macro in: This Workbook then click the OK button.
Excel is now recording your actions to create a macro.
5. Select Columns A & B and then right-click on the highlighted Column Bar to Hide them.
6. Then select Column I and press Ctrl + Shift + Right Arrow to include all remaining columns
on the right.

7. Right-click on the highlighted Column Bar then click on Hide.


Your worksheet should now look like this:
To end the macro recording:
8. On the View ribbon, click on Macros and select Stop Recording.
Good job!
You have created your first macro in Excel!

But wait, where is the recorded macro?


To view all of the available Excel macros :
1. Select View Macros.

2. This opens the Macro window. Saved macros will be listed here and you can Run whichever
one you need.
You can also click on Edit to view the VBA code window.

3. The VBA code editor opens.


Notice the Hide_Columns Sub procedure. You don’t have to write or edit VBA code for the
macro.
Excel automatically generated each code line based on the recorded keystrokes and mouse clicks.
The Record Macro feature is powerful enough for general spreadsheet automation needs.
But if you want to customize your own VBA macro, you can learn more about Visual Basic for
Applications (VBA) here.

Using the Developer tab


Let’s record another macro to Unhide the hidden columns.
This time, you can record the macro from the Developer tab.
The Developer tab gives you access to a lot of useful Microsoft Excel features such as the Visual
Basic Editor. It also allows you to quickly insert form controls such as buttons and checkboxes.
However, the Developer tab is not visible in the Excel ribbon by default.
To add it:
1. Right-click on the Excel ribbon.
Select Customize the Ribbon.
2. This opens the Customize Ribbon window.
On the right side, check the Developer tab checkbox.

3. You should now see the Developer tab.

To start recording the Unhide macro:


1. Click on the Record Macro button in the Developer tab.

2. Name this macro Unhide_Columns.


3. Click OK.
The recording has started.
4. Press Ctrl + A twice to select all cells.
5. Right-click anywhere on the Column Bar then click Unhide.
6. Click on the Stop Recording macro button to finish up.

Great work!
Now you have two recorded macros that can be executed.

How to run an Excel macro


To run your macros:
1. Click on the Macros button from the Developer tab.
2. In the Macro window, select the macro Hide_Columns and click on Run.

The macro executes the actions recorded earlier and hides the unnecessary columns.
You can also run macros from the View ribbon.

Run Excel macro from the View tab


This time, run the Unhide_Columns to show all the columns.
1. On the View ribbon, click the Macros button and select View Macros.
2. Select the Unhide_Columns macro and Run it.

This unhides all the columns in the worksheet.


As you can see, the Macro window allows you to quickly run all the available macros.
But you can execute them even faster by using buttons and shortcuts

Run Excel macro from a button


For this next example, you will assign macros to buttons which will be located on top of the
table.
1. Insert 2 rows above the table headers. Select Row 1 then press Ctrl + Shift + Plus Sign(+)
twice.

2. To create a button, click on Insert > Illustrations > Shapes.


Then select the Rectangle.
3. Draw a rectangle and format it as you’d like. Label it “HIDE”.

This will be your HIDE button. Place it between columns A & B so it will be hidden with the
columns when the macro runs.
4. To assign a macro, right-click the shape and select Assign Macro.
5. In the Assign Macro window, select Hide_Columns and click OK.
The Hide button now works!
Now, do the same for the Unhide_Columns macro.
6. Create another rectangle button and label it “UNHIDE”.

7. Repeat Steps 4 & 5 but this time, assign the Unhide_Columns macro.
Alright!
Now you can quickly run your macros using the HIDE and UNHIDE buttons.

Run Excel macro from a shortcut key


It is sometimes better to run macros using a keyboard shortcut.
For this next example, you want to quickly highlight people on the list that expressed interest in
the business.
To create a macro for this:
1. Select any cell within the table.

2. On the Developer tab, toggle ON the Use Relative References button.

3. Start recording with the Record Macro button on the Developer tab.
Or, you can also click the Record Macro button on the Status Bar.

4. Name the macro Mark_Interested.


Then assign a shortcut key. For example, Ctrl + Q.

Click OK. The recording has now started.


4. Highlight the row of the Active Cell using the keyboard shortcut Shift + Space Bar.

When selecting cells or expanding selections while recording a macro, it is best to use keyboard
shortcuts.
This is so that Excel can record the selections as relative references.
For example, if you select Row 4 by clicking on the Row Bar, Excel will record this as an
absolute reference. This means it will always select Row 4 regardless of the currently Active
Cell.
When you use the Shift + Space Bar shortcut instead, it tells Excel to select the row of the
current Active Cell.

Kasper Langmann, Microsoft Office Specialist

5. Apply the formatting:

● Fill using the color Green


● Change font color to White

6. End the macro recording from the Status Bar

All done!

*****************************************************************************
Scenario Manager in Excel
Share on Facebook Share on Twitter

Share

What is Scenario Manager in Excel?


Scenario Manager in Excel is used to compare data side by side and also swap multiple sets of
data within a worksheet. In simple words when you have multiple variables and you want to see
their effect on the final result, and also want to estimate between two or more desired budgets
you can use Scenario Manager. It is built-in functionality in excel and can be spotted under the
head What-If Analysis. It allows users to change input values up to a maximum of 32 cells.
Let’s take an example of Event Management who wish to host an event. An important step is to
decide the venue as it plays a major role in determining expenditure, revenues, profit, or loss.
You can create various scenarios consisting of different venues and then compare them.

Step by Step Learn how to use Scenario Manager in Excel:


In this example, we will use the Scenario Manager to compare two sets of numbers, they are
Small and Medium with relevant expenditure and revenue.
The above image shows estimates of Total expenditure i.e., the total of all costs. The next section
is of Total Revenue.
Note: All the cells highlighted with pink colour background denote that these are calculated
cells.

Make Your Scenario :


Step-1: Select the Cells

● Select the cells that are not calculated i.e., (the inputs) C5, C6, C7, C8, C9, C10, C11, C14.

● Go to Data Tab > What-if Analysis > Scenario Manager.


● This displays Scenario Manager dialog box as follows.

Step-2:Create First Scenario

● In the scenario manager dialog box > Click Add.


● Enter the name Small Venue.
● Select your range.
● Enter a Comment. ( optional)
● your sheet can be protected if further changes. (optional)
Click Ok. The scenario manager Dialog box will show all the cells in the scenario and their
respective current values. You can quickly create multiple scenarios by clicking on the Add and
then enter values and click Ok.
Your First Scenario is done.
The Manager has various options to add a new scenario, delete one, edit one, merge in a scenario
from another open workbook, and create a summary.
You can create as many scenarios as required depending upon your requirements. We would be
adding one more scenario for the medium scale.
Step:3-Switch Between
Double click on one of the scenario names in the list. The sheet updates the respective values.
Step-4:View all the scenarios at once

● Click Summary Button.


● Check whether you want it in a pivot table format or scenario summary.
Click OK. That creates a new worksheet called scenario summary.
Current values columns represent values of changing cells at time scenario report was created.
Changing cells for each scenario are highlighted in grey colour.
***************************************************************************

You might also like