Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
60 views
69 pages
Content It Skill Lab
Content it skill lab format
Uploaded by
1995ruch
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save content it skill lab For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
60 views
69 pages
Content It Skill Lab
Content it skill lab format
Uploaded by
1995ruch
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save content it skill lab For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 69
Search
Fullscreen
Pag s. e No Particular No. 1 How to Create a Pivot Table 3-8 How to Analyzing data using Goal Seek 2 & Solver in Pivot Table 9-10 How to Create a Summery Report In 11- 3 Pivot Table 13 How to Validate and Audit data In Pivot 14- 4 Table 23 How To Set, Edit Validate Criteria for Data Entry in a Cell Range Like: Whole | 24-2 5 | Number, Decimal, Date, Time 7 How to Create Application in 28-4 6 | Spreadsheet and Macros 1 42- 7 | How to Create a Column Chart 43 44- 8 | How to Create a Bar Chart 50 51- 9 How to Create a Line Chart 54 55- 10 How to Create a Pie Chart 57 How to Create a Combined chart like: | 58- 11 Column and Line, Column And Area__| 63 64- 12 | How to Display an image in Chart Area | 66Pivot tables are one of Excel's most powerful features. A pivot table allows you to extract the significance from a large, detailed data set. Our data set consists of 213 records and 6 fields. Order ID, Product, Category, Amount, Date and Country. A 8 c D E F o | ok 1 |OrderID Product Category Amount Date ‘Country 5 alcarrots Vegetables $4,270 1/6/2016 United States 3 2 Broccoli Vegetables $8,239 1/7/2016 United Kingdom a| 3 Banena Fruit $617 _ 1/8/2016 United states 5| 4 Banena Fruit $8,384 1/10/2016 Canada 6| SBeans Vegetables $2,625 1/10/2016 Germany 7 6 Orange Fruit $2,610 1/11/2016 United states 3 | 7 Broccoli Vegetables $9,062 1/11/2016 Australia 3) 8 Banana Fruit $6,905 1/16/2016 New Zealand 10) 9 Apple Fruit $217 1/16/2016 France Insert a Pivot Table To insert a pivot table, execute the following steps. 1. Click any single cell inside the data set. 2. On the Insert tab, in the Tables group, click PivotTable. sa mS fal) i} FREER Recommended Table PivetTebles Tabies The following dialog box appears. Excel automatically selects the data for you. The default location for a new pivot table is New Worksheet. 3. Click OK.resectable 7 x © blesnoe | Saris = vse an ema ets ower ice Wenanet O pisting wont sation a ‘noose wheter you wane ae mute ables Drag fields The PivotTable Fields pane appears. To get the total amount exported of each product, drag the following fields to the different areas. 1. Product field to the Rows area. 2. Amount field to the Values area. 3. Country field to the Filters area. PivotTable Fields + * ere 2) 2 Comtny Below you can find the pivot table. Bananas are our main export product. That's how easy pivot tables can be!A 8 g 1 [country (ait) = 2 4 Row tabels|~ sum of amount 4 |Apole 192257 6 [Beans S72 7 leraccel pee 8 [carrots 136945, 9 reergo 37079 10 orange roma 1 [Grand Total sora 2 Sort To get Banana at the top of the list, sort the pivot table. 1. Click any cell inside the Sum of Amount column. 2. Right click and click on Sort, Sort Largest to Smallest. Dy con BB Been AL Sutagete sate». > ore Sor 0 Show Valuer As , Pivot Table Options IB Hie ais Result. 1 [country (all) 2 3 Row Labels -! Sum of Amount 4 [Banana 340295] 5 \Apple 191257 6 Broccoli 142438 7 |carrots 136945 8 |Orenge 104438 9 [Beans 57281 10 |Mango 57079 LL Grand Total 1029734Filter Because we added the Country field to the Filters area, we can filter this pivot table by Country. For example, which products do we export the most to France? 1. Click the filter drop-down and select France. Result. Apples are our main export product to France. . fb Esa Seat + ponte ma lores ia Evecs me § prot Sa eg rat a Note: you can use the standard filter (triangle next to Row Labels) to only show the amounts of specific products. Change Summary Calculation By default, Excel summarizes your data by either summing or counting the items. To change the type of calculation that you want to use, execute the following steps. 1. Click any cell inside the Sum of Amount column. 2. Right click and click on Value Field Settings. Nuinber Format LE Rete i Pivot Tab S3. Choose the type of calculation you want to use. For example, click Count. [vera seis a sumac ie fed y cohen canon tity uatts ete ummase Fr 4, Click OK. Result. 16 out of the 28 orders to France were ‘Apple’ orders. A 1 [Country 2 3 Row Labels = 4 [Apple Banana 5 6 |carrots 7_|Mango 8 |orenge 9 [Beans 40 |rocealt 11 [rand total 2 ‘Two-dimensional Pivot Table If you drag a field to the Rows area and Columns area, you can create a two- dimensional pivot table. First, insert a pivot table. Next, to get the total amount exported to each country, of each product, drag the following fields to the different areas. 1. Country field to the Rows area. 2. Product field to the Columns area 3. Amount field to the Values area. 4. Category field to the Filters area.PivotTable Fields > * Below you can find the two-dimensional pivot table. 4 category ca [= 3 Samat Amount Cola 4 Rowlabels~/Apple Banana Beans Broccoli Carrots Mango Orange Gra Tot 5 Ausvala Boe S272 aoe 51e6 e580 IB 6 cansce aus) a7 M07 DT 1s SEN 8 Germany 082 39686 2905 7157 7186 ETS HN? ASICS 9 New2eslind 10882. aans0 250 sama 72 AdlUnitee kingdom 1534 42506. S100 9825 A185 5500 2788173197 alUnmedstees 2515 55051 7163. 2705 S626 530932257132 Lz Grandtoml «49157 310285 Sram ane s26565 Sore toan — an734 To easily compare these numbers, create a pivot chart and apply a filter. Maybe this is one step too far for you at this stage, but it shows you one of the many other powerful pivot table features Excel has to offer. couHow to analyzing data using goal seek and solver in pivot table The Goal Seek Excel function (often referred to as What-ifAnalysis) is a method of solving for a desired output by changing an assumption that drives it. The function essentially uses a trial and error approach to back- solving the problem by plugging in guesses until it arrives at the answer. For example, if the formula for revenue is equal to the number of units sold multiplied by the selling price, Goal Seek can determine how many units have to be sold to reach $1 million of revenue, if the selling price is known. The function is extremely useful for performing sensitivity analysis in financial modeling. MD \scitute Simple Goal Seek Example Let's look at a simple exercise first, to see how Goal Seek works. Suppose we have a very basic model that takes the number of units sold, the retail price, and a discount to calculate total net revenue. The current model contains the following information # of units: 500 Retail price: $25.00 Selling discount: 10% Revenue: $11,250Now suppose we want to find out how many units have to be sold to reach $20,000 of revenue. See the screenshot below and follow the steps listed to use the Goal Seek Excel tool. scout 10% Steps to Use Goal Seek Excel: 1, Put the cursor on the cell that contains the output you want to change (revenue) 2. On the Data ribbon, select What-itanalysis, then select Goal Seek (keyboard shortcut is Alt, A, W, G) 3. When the dialog box appears (as shown below) make “Set cell” equal to the revenue cell (E10) 4, Set “To value” equal to the output you want to achieve (type the number in) 5. Set “By changing cell” equal to the assumption you want to solve for (# of units, or cell E4) 6. Press OK Below is the output from the analysis. We can see that to achieve $20,000 of revenue, 889 units need to be sold. Notice that the solution is displayed directly in cell (E4), not in the dialogue box Press OK to keep the solution running in the model (cell £4 will permanently change to 889 units), or press Cancel to return to the original assumption (500 units) 10Deco Rene s2.0000 how to create a summary report in pivot table Microsoft says that 80% of people using Excel have never used a pivot table As I near the end of my series of 40 Days of Excel, an introduction to pivot tables Pivot tables are miraculous. You are given a workbook with thousands of rows of detailed data. You can summarize that data in just a few clicks using a pivot table. I've written entire books on pivot tables, so today, | want to walk you through building your first pivot table. Say that you have 6464 rows of data with Customer, Product, Date, Quantity Revenue. You want to find the revenue for the top 5 customers who bought widgets. 1. Select one cell in your data set 2. On the Insert tab of the Ribbon, select Pivot Table aa Bh a: Dror seared Te Pots Sane ae es Poway sas? : | Thesaien ono Msn ede 1 fesoner edict Date ant Revue evs un aves uno 23Uabi9 311 IBLE (Billie sen oventece aay ——Jndget apainis eta fea spamererpres rope 2/1/0195 as skye acget rains amo sewe {eae Opiier Gone pinata assis fester optiter Simo upinos sm aime fear epee Gadget /fnis sas tees erent Gace 2/019 oe area ie nigel 284019 9 eel fash, Gadget inns ase sd Start your pivot table }. In the Create PivotTable dialog, choose Existing Worksheet. Always leave a blank column between your data and the pivot table, so in this case, choose cell G2 for the place to hold your pivot table. Select where to build the pivot table The PivotTable Fields panel appears on the right side of your screen. At the top of the panel are a list of the fields in your data set. At the bottom are four drop zones with confusing names. 12Slicers Fields are better across top than here Filters Fields = Numbers along tosum leftside here here Drag fields to these drop zones Drag the Customer field from the top of the PivotTable Fields list and drop it in the Rows drop zone. Drag the Revenue field from the top of the PivotTable Fields list and drop it in the Values drop zone. Drag the Product field to the Filters drop zone. Open the filter drop-down in H2 and choose Widget. At this point, you will see a summary of the customers who bought widgets/ Just 7 steps to build this summary report There are two PivotTable tabs in the Ribbon, Go to the Design tab Choose Report Layout, Show in Tabular Form. This changes the heading in G3 from Row Labels to Customer. It also makes the pivot table better if you add more row fields later. Open the drop-down in G3, Choose Value Filters, Top Ten. In the Top 10 Filter (Customer) dialog, choose Top, 5 Items by Sum of Revenue. Click OK. B10. _ Pivot tables never choose the right number format. Select all of the Revenue cells, from H4:H9. Assign a Currency format with 2 decimal places. 1 If you want the report sorted with the largest customer at the top, choose any one revenue cell and click the Sort Descending (ZA) icon on the Data tab. This is a shortcut for opening the drop-down in G3 and selecting Sort Z to A. At this point, you've solved the original question: “he Salem Ohio Historical Saciety Bite of Contes symons staat ‘MyxcelOnlineom $7274 ‘and Total ‘7,207,007 The finished pivot table However, Pivot Tables are easy to change. Now that you've answered the first question, try any of these: * Change the dropdown in H1 from Widget to Gadget to see the top customers for gadgets. * Double-click the revenue in H4 to see a list of all the records that make up that data. The report appears on a new worksheet to the left of the current worksheet. * Click the Pivot Chart icon on the Analyze tab to chart the top 5 customers How to validating and auditing data in pivot table You might want to check formulas for accuracy or find the source of an error. Excel Formula Auditing commands provide you an easy way to find + Which cells are contributing in the calculation of a formula in the active cell. * Which formulas are referring to the active cell. These findings are shown graphically by arrow lines that makes the visualization easy. You can display all the formulas in the active worksheet with a single command. If your formulas refer to cells in a different workbook, 4open that workbook also. Excel cannot go to a cell in a workbook that is not open. Setting the Display Options You need to check whether the display options for the workbooks you are using are correctly set. + Click FILE > Options. + Inthe Excel Options dialog box, click Advanced. * In Display options for the workbook - o Select the workbook. o Check that under For objects, show, All is selected. * Repeat this step for all the workbooks you are auditing. [Prepon Tracing Precedents Precedent cells are those cells that are referred to by a formula in the active cell. In the following example, the active cell is C2, In C2, you have the formula =B2*C4, B2 and C4 are precedent cells for C2. Formula in Active Call As c pier 505[___ 205030 }— Active Cell 405 To trace the precedents of the cell C2, 15* Click in the cell C2. * Click the Formulas tab. * Click Trace Precedents in the Formula Auditing group. ata — i os ‘Two arrows, one from B2 to C2 and another from C4 to C2 will be displayed, tracing the precedents Formula inthe Active Cell a. fi || sores | + [mm |e 2 Sa Ave llth Forma 3 een 2 Precedents 406 Note that for tracing precedents of a cell, the cell should have a formula with valid references. Otherwise, you will get an error message. * Click in a cell that does not contain a formula or click in an empty cell * Click Trace Precedents in the Formula Auditing group. You will get a message. f YO GGOR Bow == Removing Arrows Click Remove Arrows in the Formula Auditing group. 16EB SRLR OBE ppacinm an eee All the arrows in the worksheet will disappear. Tracing Dependents Dependent cells contain formulas that refer to other cells. That means, if the active cell contributes to a formula in another cell, the other cell is a dependent cell on the active cell In the example below, C2 has the formula =B2*C4. Therefore, C2 is a dependent cell on the cells B2 and C4 — jroaks I [rezone] elldependent P ses on BZ and CE 406 To trace the dependents of the cell B2, * Click in the cell B2. * Click the Formulas tab. * Click Trace Dependents in the Formula Auditing group. ' Tae gees T v7An arrow appears from B2 to C2, showing C2 is dependent on B2. To trace the dependents of the cell C4 - + Click in the cell C4. * Click the Formula tab > Trace Dependents in the Formula Auditing group. Another arrow appears from C4 to C2, showing C2 is dependent on C4 also. a . fe | 406 D *—585—, 205030 Click Remove Arrows in the Formula Auditing group. All the arrows in the worksheet will disappear. Note - For tracing dependents of a cell, the cell should be referenced by a formula in another cell. Otherwise, you will get an error message. * Click in the cell B6 is not referenced by any formula or click in any empty cell. * Click Trace Dependents in the Formula Auditing group. You will get a message. eT BHGCR BBS wt “Fearne rere br Working with Formulae You have understood the concept of Precedents and Dependents. Now, consider a worksheet with several formulae 18* Click in a cell under Pass Category in Exam Results table. * Click Trace Precedents, The cell to its left (Marks) and the range E4:F8 will be mapped as the precedents. + Repeat for all the cells under Pass Category in Exam Results + Click in a cell under Pass Category in Student Grades table + Click Trace Dependents. Alll the cells under Pass Category in Exam Results table will be mapped as the dependents. Showing Formulas The worksheet below contains the summary of sales by the salespersons in the regions East, North, South, and West. 19Total Sales 3 1224 4 1625 5 1857 6 1687 7] [-~sz23] 8 + Click the FORMULAS tab on the Ribbon. * Click Show Formulas in the Formula Auditing group. The Formulas in the worksheet will appear, so that you will know which cells contain formulas and what the formulas are. Co " snipe & 7B OGCR BOB oes * Click in a cell under TotalSales. * Click Trace Precedents. A worksheet icon appears at the end of the arrow. The worksheet icon indicates that the precedents are in a different workshee' 4 8 c Name Total Sales vicky a4-= 1326 IMathew=——— 1625 5” Tatherine 1957 ane 3687 7 Total 5323 Double-click on the arrow. AGo TOdialog box appears, showing the precedents 20‘As you observe, there are four precedents, on four different worksheets * Click a reference of one of the precedents + The reference appears in the Reference box. * Click OK. The worksheet containing that precedent appears. Evaluating a Formula To find how a complex formula in a cell works step by step, you can use Evaluate Formula command Consider the formula NPV (Middle Year) in the cell C14. The formula is =SQRT (1 + €2)*C10 + Click in the cell C14, * Click the FORMULAS tab on the Ribbon. + Click Evaluate Formula in the Formula Auditing group. The Evaluate Formula dialog box appears. lm ve or In the Evaluate Formula dialog box, the formula is displayed in the box under Evaluation. By clicking the Evaluate button several times, the formula gets evaluated step-wise. The expression with an underline will always be executed next. ‘ase Formula Dog eacromas b = Formula vatate —> ESE] sein oe 21Here, C2 is underlined in the formula. So, it is evaluated in the next step. Click Evaluate. Cell C2 has value 0.2. Hence, C2 will be evaluated as 0.2. 1+0.2 is underlined showing it as the next step. Click Evaluate. ee 1+0.2 will be evaluated as 1.2. SQRT(1.2) is underlined showing it as next step. Click Evaluate. SQRT(1.2)_ will be evaluated as 1.09544511501033. C10 is underlined showing it as next step. Click Evaluate. 22C10 will be evaluated as 4976.8518518515. 1.09544511501033*4976.8518518515 is underlined showing it as next step. Click Evaluate. 1.09544511501033*4976.8518518515 will be evaluated as 5,451.87. There are no more expressions to evaluate and this is the answer. The Evaluate button will be changed to Restart button, indicating completion of evaluation. Error Checking It is a good practice to do an error check once your worksheet and/or workbook is ready with calculations Consider the following simple calculations. [Veluea | 400 Ivalue2 | 600 [Values | 200 5| Wats worvr The calculation in the cell has resulted in the error #DIV/0!. * Click in the cell C5. * Click the FORMULAS tab on the Ribbon. 23* Click the arrow next to Error Checking in the Formula Auditing group. In the drop-down list, you will find that Circular References is deactivated, indicating that your worksheet has no circular references. + Select Trace Error from the drop-down list. ies Te eeaoee ee or Ccg > Has © Click Remove Arrows. * Click the arrow next to Error Checking Select Error Checking from the drop-down list. rer Cheing ne i Ca The Error Checking dialog box appears. [erage EE oo eee Observe the following - 24If you click Help on this error, Excel help on the error will be displayed. If you click Show Calculation Steps, Evaluate Formula dialog box appears If you click Ignore Error, the Error Checking dialog box closes and if you click Error Checking command again, it ignores this error. If you click Edit in Formula Bar, you will be taken to the formula in the formula bar, so that you can edit the formula in the cell. How to set, edit validation criteria for data entry in a cell range like: whole number, decimal, data, time Create a Validation Rule 1. 2. 3. w Select the cells you want to validate. Click the Data tab. Click the Data Validation buttor . Click the Allow list arrow. . Select the type of data you want to allow. 25,Any value: No validation criteria applied © Whole number: Allows a whole number between the minimum and maximum limits set. © Decimal: Allows a decimal or a percent entered as a decimal between the set limits. © List: Allows a value from a list of choices. A list arrow appears in the cell, and users can choose from the list. © Date: Allows a date within set limits o Time: Allows a time within set limits. © Text length: Allows text containing a certain number of characters. © Custom: Allows a formula to be entered to calculate what is allowed in the cel | . Specify the data validation rules. The validation options will vary depending on the option selected in the Allow field. . Click OK. 26The data validation is set for the selected cell(s). When a user tries to enter data that is not valid, Excel will prevent the entry and display a message about the cell being restricted. To find validated data in a worksheet, click the Find & Select button in the Editing group on the Home tab and select Data Validation. The validated cells are highlighted. Add Input and Error Messages Prevent data validation issues by setting up Excel to display a message whenever a cell or range of cells is selected. These messages are useful when other people will be entering data in your worksheet. An error message can be configured to appear when data is entered that does not match a data validation rule. 1. Select the cells where you want an input message to appear. 2. Click the Data tab. 3. Click the Data Validation button. 4. Click the Input Message tab 5. Enter an input message. 76. Click the Error Alert tab. 7. Select an error alert style. © Stop: Prevents users from adding invalid data in a cell. © Warning: Warns that the data entered is invalid, but users can click Yes to accept the invalid entry, No to edit it, or Cancel to remove it. © Information: Informs users that the data entered is invalid, but users can click OK to accept the invalid entry or Cancel to remove it. 2. Enter an error alert message. 283. Click OK. 4. Select a cell with an input message Now when a cell in the range is selected, the title and message display. If you enter an invalid value, a custom error message appears. How to create application in spreadsheet and macros What Are Excel Macros? Macros are code that automate work in a program—they let you add your own tiny features and enhancements to help you accomplish exactly what you need to do, quickly with just a click of abutton. In a spreadsheet tool like Excel, macros can be especially powerful. Hidden behind the normal user interface, they are more powerful than standard functions you enter into a cell (e.9.=IF (A2<100,100, A2)). These macros make Excel work for you. They replace actions that you do manually—everything from formatting cells, copying values, and calculating totals. So with a few clicks you can quickly replace repetitive tasks. To make these macros, you can simply record your actions in Excel to save them as repeatable steps or you can use Visual Basic for Applications (VBA), 29a simple programming language that's built into Microsoft Office. We'll show you how to use both below, as well as share examples of Excel macros to help you get started. Tip: This guide and all examples are written in Excel 2016 for Windows, but the principles apply to Excel 2007 and newer for both Mac and PC. Why Use Excel Macros? Learning how to automate Excel is one of the easiest ways to speed up your work--especially because Excel is used in so many work processes. Say every week you export analytics data from your content management system (CMS) to create a report about your site. The only problem is, those data exports aren't always in an Excel-friendly format. They're messy and often include far more data than your report requires. This means you have to clean up empty rows, copy and paste data into the right place, and create your own charts to visualize data and make it print-friendly. All of these steps may take you hours to complete. If there only was a way to press one button and let Excel do it for you in an instant... Well, can you guess what I’m about to say next? There is! All it requires is a little bit of time to set up a macro, and then that code can do the work for you automatically every time. It's not even as difficult as it sounds. How to Build Your First Excel Macro You already know your way around Excel, and are familiar with its grid of cells where you enter your text and functions. To build Excel macros, though, you'll need an extra tool that's built into Excel: the Visual Basic Editor. 30Before You Proceed: Be sure to download our project file - you'll need it for later to follow our Excel macros tutorial, Meet The VBA Editor Excel has a built-in tool for writing macros called the Visual Basic Editor—or VBA Editor for short. To open that, open a spreadsheet and use the shortcut Alt + F11 (for Mac: Fn + Shift + F11). The new window that pops up is called the VBA Editor. It's where you'll edit and store all of your macros. Its layout may look a bit different from this screenshot, but you can move the windows around to the order you want. Just be sure to keep the Project Explorer pane open so you can easily edit your macros. Be Eat ew pan Format Deovg fin [00s 888s Woon ie e-u saweryne This is the Project Explorer. Ifyou don't see it, click "View’ -> 'Project Explorer’. Your macros will be made up of "Modules," or files with your VBA code. You'll add a new module or open an existing one in the VBA Editor, then type in the code you want. To insert a module, click "Insert" and then click "Module". You'll then see the blank space to write your code on the right. 31sie st Vow Peer Format Debug in Took Ame Wow Hele Baru ” yuu See > Ounce Project =VBAProject |x| [Ieee [PB verrencr amen) & This is where the VBA-code goes. How to Record an Excel Macro There are two ways to make a macro: code it or record it. The main focus of this article is on the former, but recording a macro is so simple and handy, it's worth exploring too. Recording a macro is a good way of getting to know the basics of VBA. Later on, it serves as handy storage for code that you don’t need to memorize When you record a macro, you tell Excel to start the recording. Then you perform the tasks you want to be translated into VBA code. When you're done, tell Excel to stop recording and you can use this new macro to repeat the actions you just performed again and again. There are limitations to this, so you can't automate every task or become an expert in automation by only recording. You'll still need to type or edit code manually sometimes. But it's still a handy way to get started. Here's how: 1. Go to the "View" tab of the ribbon and click the tiny arrow below the "Macros" button. 2. Then click "Record Macro" 3, Type in the name of your macro and click "OK" to start the recording. 4. Perform the actions in your spreadsheet you want to be turned into a macro. 5. When you're done, go to the "View" tab, click the tiny arrow below the "Record Macro" button again and select "Stop recording". 323 fe 5 a Now, use the shortcut Alt + F11 (for Mac: Fn + Shift + F11) to open the VBA Editor, and double-click "Module 1" in the Project Explorer. This is your first code! Amazing, right? You may not have written it yourself, but it’s still generated from your actions. 4 Mesatt Este kat Yew wet Farmar Qenup in Teo dane iow ep Be-u oo eae NH" O nace Project -VaAProject [15 vant to) ; es 8 eee raises Yours probably look different than mine. Can you guess what my code does? Sub Makebold is just the text Sub followed by the name | entered when | started recording The green line doesn’t actually do anything—it's a comment where you could add an explanation of what the macro does. Selection.Font.Bold = True makes the values in the selected cells bold. End sub simply tells Excel that the macro stops here. 33,Now, what will happen if | change the True part of the third line to False? The macro would then remove any bold formatting from the selection instead of making it bold. That's how you record a simple macro. But the real power of macros comes when you can write it yourself—so let's get started learning to write simple VBA code. How to Code Your Own Excel Macros Macros are just bits of code in Excel that do your bidding. Once you write the code in the VBA Editor, you can run it and let the code work its magic on your spreadsheet. But what's even better is to build your macro into your spreadsheet, and the best too! for that is buttons. So first, before we start coding, let's add a button to run our macro. Add a Button to Run Your Macro You can use various Excel objects as buttons for running macros, but | prefer to use a shape from the "Insert" tab. When you have inserted your shape, right click it and select "Assign Macro..." Then select the macro you want to run when the shape is clicked—perhaps the one you just made with a recording and save it by clicking "OK". 34 Downloaded by RUCHIKA SINGH (
[email protected]
)Now, when you click the shape which we just tured into a button, Excel will tun the macro without having to open the code each time. There's one other thing to note before we get started: saving your spreadsheet with Macros. By default, Excel spreadsheet files with an .xlsx extension cannot include macros. Instead, when you save your spreadsheet, select the "Excel Macro-Enabled Workbook (*.xlsm)" format, and add your file name as normal Go ahead and do that to save your spreadsheet before we start coding. Now, let’s get started with actual coding! Copying and pasting is the simplest way to move data around, but it's still tedious. What if your spreadsheet could do that for you? With a macro, it could, Let's see how to code a macro that will copy data and move it around in a spreadsheet. Open the project file you downloaded earlier and make sure the "Copy, cut, and paste" sheet is selected. This is a sample employee database with the names, departments, and salaries of some employees. Let’s try to copy all the data in columns A through C into D through F using VBA. First, let's look at the code we need: Copying Cells with VBA Copying in VBA is quite easy. Just insert this code into the VBA Editor: Range("Insert range here").Copy. Here's some examples: 35,+ Range("A:C").Copy — copies column A through C + Range("A1:C100").Copy — copies the range A1:C100 Remember when you recorded a macro before? The macro had Sub Nameofmacro() and End sub at the top and bottom line of the code. These lines must always be included. Excel makes that easy, too: When you type in "Sub" followed by the macro name in the beginning of the code, the End sub is automatically inserted at the bottom line. Tip: Remember to enter these lines manually when you're not using the macro recorder. Pasting Cells with VBA Pasting can be done in different ways depending on what you want to paste. 99% of the time, you'll need one of these two lines of code: + Range("The cell/area where you want to paste").Pastespecial — pastes as normal (formulas and formatting) + Range("The cell/area where you want to paste"),Pastespecial xIPasteValues — only pastes values Cutting Cells with VBA If you want to relocate your data instead of copying it, you need to cut it. Cutting is quite easy and follows the exact same logic as copying. Here’s the code: Range("Insert range here").Cut When cutting, you can’t use the ‘PasteSpecial’ command. That means that you can’t paste values only, or formatting only. Therefore, you need these 36lines to paste your cells with VBA: Range("Insert where you want to paste") Select ActiveSheet Paste For example, here's the code you'd need to cut the range A:C and paste it into D1 * Range("A:C").Cut + Range("D1").Select * ActiveSheet.Paste Copying, cutting, and pasting are simple actions that can be done manually without breaking a sweat. But when you copy and paste the same cells several times a day, a button that does it for you can save a bunch of time Additionally, you can combine copying and pasting in VBA with some other cool code to do even more in your spreadsheet automatically. Adding Loops to VBA | just showed you how to take a simple action (copying and pasting) and attach it to a button, so you can do it with a mouse click. That's just one automated action. When you have the code to repeat itself, though, it can do longer and more complex automation tasks in seconds. Take a look at the "Loops" sheet in the project file. It's the same data as in the previous sheet, but every third row of the data is now moved one column to the right. This type of faulty data structure is not unusual when exporting data from older programs. This can take a lot of time to fix manually, especially if the spreadsheet includes thousands of rows instead of the small sample data in this project file. 37Let’s make a loop that fixes it for you. Enter this code in a module, then look at the explanations below the picture: (Genera =] foo Sup icone 0] 1. This line makes sure the loop starts at the top-left cell in the sheet and not accidentally messes the data up by starting somewhere else. 2. The For i = 1 To 500 line means that the number of times the loop has run (represented by i) is an increasing number that starts with 1 and ends with 500. This means that the loop will run 500 times. The number of times the loop should run depends on the actions you want it to do. Use your good sense here. 500 times is way too many for our sample dataset, but would fit perfectly if the database had 1500 rows of data 3. This line recognizes the active cell and tells Excel to move 3 rows down and select that cell, which then becomes the new active cell. If it was every fourth row that was misplaced in our data, instead of every third, we could just replace the 3 with a 4 in this line. 4. This line tells Excel what to do with this newly selected cell. In this case, we want to delete the cell in such manner that the cells to the right of the cell are moved left. That is achieved with this line. If we wanted to do something else with the misplaced rows, this is the place to do it. If we wanted to delete every third row entirely, then the line should've been: Selection.€ntirerow.delete. 385. This line tells Excel that there are no more actions within the loop. In this case, 2 and 5 are the frame of the loop and 3 and 4 is the actions within the loop When we run this macro, it will result in a neat dataset without any misplaced rows Adding Logic to VBA Logic is what brings a piece of code to life by making it more than just a machine that can do simple actions and repeat itself. Logic is what makes an Excel-sheet almost human—it lets it make intelligent decisions on its own. Let's use that to automate things! This section is about |F-statements which enables the "if-this-then-that" logic, just like the |F-function in Excel Let's say the export from our website CMS was even more erroneous than expected. Every third row is still misplaced, but now, some of the misplaced rows are placed 2 columns to the right instead of 1 column to the right. Take a look at the sheet "IF-statement" in the project file to see what it looks like. How do we take this into account in our macro? We add an IF-statement to the loop! Let's formulate what we want Excel to do: We start in cell Al. Then we go three rows down (to cell A4, A7, A10, etc.) until there’s no more data. Every time we go three rows down we check this row to see if the data has been misplaced by 1 or 2 columns. Then move the data in the row either 1 or 2 columns to the left. 39Now, let’s translate this into VBA code. We'll start with a simple loop, as before: Beginning and end of macro Beginning and end of loop The actions within the loop The only thing we need now is to write what should happen within the loop. This is the "go three rows down" part that we developed back in the section about loops. Now we're adding an IF-statement that checks how much the data is misplaced and corrects it correspondingly. This is the final code to copy into your module editor, with each step explained below: 1. This is the first part of the IF-statement. It says that if the cell right of the active cell (or Activecell.Offset(0,1) in VBA code) is blank (represented by = "") then do something. This something is the exact same action as we did when we created the loop in the first place: deleting the active cell, and moving the active row one cell to the left (accomplished with the Selection.Delete Shift:=xIToLeft code). This 40time, we do it two times instead of one, because there are two blank cells in the left side of the row. 2. If the above is not true, and the cell right of the active cell is not blank, then the active cell is blank. Therefore, we only need to delete the active cell and move the active row one cell to the left one time. The IF-statement must always end with an End If to tell Excel it's finished running. After the IF-statement, the loop can run again and again, repeating the IF-statement each time Congratulations, you've just created a macro that can clean up messy data! See the animation below to see it in action (If you haven't already tried it yourself). Automate Excel Without Macros Excel macros have only one problem: they're tied to your computer, and they can't run in the Excel Web App or on your mobile device. And they're best at working on data already in your spreadsheet, making it difficult to get new data from your other apps into your spreadsheet. App integration tool Zapier can help. It connects the Office 365 for Business edition of Excel to hundreds of other apps—Stripe, Salesforce, Slack, and more—so you can log data to your spreadsheet automatically or start tasks in other apps right from Excel Here's how it works. Say you want to save your Typeform form entries to an Excel spreadsheet. Just create a Zapier account, and click the Make a Zap button in the top right corner. Then, select Typeform in the app picker, and set it to watch your form for new entries 41Zapier can watch your Typeform form for new entries Test your Zap, then click Continue to add another step to your Zap. This time welll select the Excel app, and choose to Add a Row to our spreadsheet. You could also update a row, or search your spreadsheet for a specific row if you wanted. Zapier lets you add, update, or find rows in your Excel spreadsheet Now, choose your spreadsheet and worksheet, then click the + icon on the right of each spreadsheet row to select the correct form field to save to that spreadsheet row. Save and test your Zapier integration, then turn it on. Then every time your Typeform form gets filled out, Zapier will save that data to your Excel spreadsheet. 42Zapier can add your form data directly to the spreadsheet row you want Here are some great ways to get started automating Excel with Zapier in a few clicks—or build your own Excel integrations to connect your spreadsheets to your favorite apps. 43How to create a column chart Column charts are useful for showing data changes over a period of time or for illustrating comparisons among items. In column charts, categories are typically organized along the horizontal axis and values along the vertical axis. EAST ASIA SALES For information on column charts, and when they should be used, see Available chart types in Office. ExcelOutlook To create a column chart, follow these steps: 1. Enter data in a spreadsheet. 2. Select the data. 3. Depending on the Excel version you're using, select one of the following options: + Excel 2016: Click Insert > Insert Column or Bar Chart icon, and select a column chart option of your choice. 44nko ® Excel 2013: Click Insert > Insert Column Chart icon, and select a column chart option of your choice. Excel 2010 and Excel 2007: Click Insert > Column, and select a column chart option of your choice. You can optionally format the chart a little further. See the list below for a few options: To apply a different chart style, click Design > Chart Styles, and pick a style. To apply a different shape style, click Format > Shape Styles, and pick a style. To apply different shape effects, click Format > Shape Effects, and pick an option such as Bevel or Glow, and then a sub option. To apply a theme, click Page Layout > Themes, and select a theme. To apply a formatting option to a specific component of a chart (such as Vertical (Value) Axis, Horizontal (Category) Axis, Chart Area, to name a few), click Format > pick a component in 45,the Chart Elements dropdown box, click Format Selection, and make any necessary changes. Repeat the step for each component you want to modify. Luk, © Format Selecti centewcne ered — Vertical (Value) Axis Current Selection How to create a bar chart A bar chart (or a bar graph) is one of the easiest ways to present your data in Excel, where horizontal bars are used to compare data values. Here’s how to make and format bar charts in Microsoft Excel. Inserting Bar Charts in Microsoft Excel While you can potentially turn any set of Excel data into a bar chart, It makes more sense to do this with data when straight comparisons are possible, such as comparing the sales data for a number of products. You can also create combo charts in Excel, where bar charts can be combined with other chart types to show two types of data together. RELATED: How to Create a Combo Chart in Excel We'll be using fictional sales data as our example data set to help you visualize how this data could be converted into a bar chart in Excel, For more complex comparisons, alternative chart types like histograms might be better options. To insert a bar chart in Microsoft Excel, open your Excel workbook and select your data. You can do this manually using your mouse, or you can select a cell in your range and press Ctr+A to select the data automatically. 462 feeamoner =| 5 lanes | 4 hota renes al 5 Fame: | | # Joep cs | | 2 fees tones al Once your data is selected, click Insert > Insert Column or Bar Chart. Various column charts are available, but to insert a standard bar chart, click the “Clustered Chart” option. This chart is the first icon listed under the “2-D Column” section. Excel will automatically take the data from your data set to create the chart on the same worksheet, using your column labels to set axis and chart titles. You can move or resize the chart to another position on the same worksheet, or cut or copy the chart to another worksheet or workbook file. For our example, the sales data has been converted into a bar chart showing a comparison of the number of sales for each electronic product. 47
You might also like
Pivot Table Exercise
PDF
100% (1)
Pivot Table Exercise
475 pages
It Skill Lab 2 Sem Mba 2nd Sem Project
PDF
100% (2)
It Skill Lab 2 Sem Mba 2nd Sem Project
70 pages
101 Advanced Pivot Table Tips and Tricks
PDF
No ratings yet
101 Advanced Pivot Table Tips and Tricks
81 pages
Excel Pivot Tables - Basic Beginners Guide To Learn Excel Pivot Tables For Data Analysis and Modeling
PDF
No ratings yet
Excel Pivot Tables - Basic Beginners Guide To Learn Excel Pivot Tables For Data Analysis and Modeling
167 pages
Week 2 Day 2 Pivot Table Notes
PDF
No ratings yet
Week 2 Day 2 Pivot Table Notes
50 pages
It Skill Lab 2 Sem Mba 2nd Sem Project
PDF
No ratings yet
It Skill Lab 2 Sem Mba 2nd Sem Project
71 pages
It Skill Lab 2 Sem Mba 2nd Sem Report
PDF
No ratings yet
It Skill Lab 2 Sem Mba 2nd Sem Report
68 pages
Createation A Pivot Table in Excel 2
PDF
No ratings yet
Createation A Pivot Table in Excel 2
21 pages
IT File 2
PDF
No ratings yet
IT File 2
74 pages
Experiment - 6 Objective: Implementation of Pivot Table in MS-Excel
PDF
No ratings yet
Experiment - 6 Objective: Implementation of Pivot Table in MS-Excel
3 pages
Pivot Tables: Insert A Pivot Table
PDF
No ratings yet
Pivot Tables: Insert A Pivot Table
7 pages
Pivot Tables
PDF
No ratings yet
Pivot Tables
24 pages
Pivot Table Notes PDF
PDF
100% (1)
Pivot Table Notes PDF
3 pages
Pivot Table ST
PDF
No ratings yet
Pivot Table ST
13 pages
Excel2010 PivotTables
PDF
No ratings yet
Excel2010 PivotTables
18 pages
23 Things You Should Know About Excel Pivot Tables - Exceljet PDF
PDF
0% (1)
23 Things You Should Know About Excel Pivot Tables - Exceljet PDF
21 pages
Exel 2016
PDF
100% (1)
Exel 2016
68 pages
Excel Charts
PDF
No ratings yet
Excel Charts
19 pages
Pivot Table
PDF
No ratings yet
Pivot Table
8 pages
Pivot Tables
PDF
No ratings yet
Pivot Tables
9 pages
Lab 4 Theory 16102020 104125am 11112021 095151am 18102022 120217pm
PDF
No ratings yet
Lab 4 Theory 16102020 104125am 11112021 095151am 18102022 120217pm
13 pages
Pivot Tables
PDF
No ratings yet
Pivot Tables
44 pages
Unit 3 Excel
PDF
No ratings yet
Unit 3 Excel
30 pages
Pivot Tables in Excel - Easy Excel Tutorial
PDF
No ratings yet
Pivot Tables in Excel - Easy Excel Tutorial
6 pages
Pivot Table Exercise
PDF
No ratings yet
Pivot Table Exercise
595 pages
Pivottable For Data Analysis in Excel
PDF
No ratings yet
Pivottable For Data Analysis in Excel
12 pages
Pract 1
PDF
No ratings yet
Pract 1
19 pages
Excel Training Unlocked
PDF
No ratings yet
Excel Training Unlocked
34 pages
Pdf&rendition 1
PDF
No ratings yet
Pdf&rendition 1
19 pages
2nd Meeting Midterm Advance Spreadsheet PDF
PDF
No ratings yet
2nd Meeting Midterm Advance Spreadsheet PDF
14 pages
Pivot Table Exercise
PDF
No ratings yet
Pivot Table Exercise
507 pages
Pivot Table Exercise
PDF
No ratings yet
Pivot Table Exercise
443 pages
Pivot Tables
PDF
No ratings yet
Pivot Tables
14 pages
Chapter 3
PDF
No ratings yet
Chapter 3
14 pages
Pivot Tble
PDF
No ratings yet
Pivot Tble
19 pages
Pivottable Lab Exercise
PDF
No ratings yet
Pivottable Lab Exercise
12 pages
Financial Modeling Unit 1 by Dr. Isha
PDF
No ratings yet
Financial Modeling Unit 1 by Dr. Isha
28 pages
Dhruvkhatri Bba1a Excelfile
PDF
No ratings yet
Dhruvkhatri Bba1a Excelfile
55 pages
Using PivotTables To Describe Data-New
PDF
No ratings yet
Using PivotTables To Describe Data-New
33 pages
Pivot Table
PDF
No ratings yet
Pivot Table
44 pages
CH 2 Dav
PDF
No ratings yet
CH 2 Dav
52 pages
Notes It
PDF
No ratings yet
Notes It
19 pages
It Project Arun Kumar
PDF
No ratings yet
It Project Arun Kumar
23 pages
Tanay It
PDF
No ratings yet
Tanay It
69 pages
Insert A Pivot Table: Mba102-Advanced Statistics With Computer Application Module 4 Exercises Pivot Tables
PDF
No ratings yet
Insert A Pivot Table: Mba102-Advanced Statistics With Computer Application Module 4 Exercises Pivot Tables
12 pages
Bhavya IT File
PDF
No ratings yet
Bhavya IT File
68 pages
Chapter 3a Pivot Tables
PDF
No ratings yet
Chapter 3a Pivot Tables
32 pages
Excel 2016 For Windows Pivot Tables - Tim Hill
PDF
95% (21)
Excel 2016 For Windows Pivot Tables - Tim Hill
68 pages
Pivot Tables: Insert A Pivot Table
PDF
No ratings yet
Pivot Tables: Insert A Pivot Table
27 pages
Content 4 CURSO EXCEL
PDF
No ratings yet
Content 4 CURSO EXCEL
25 pages
Using PivotT
PDF
No ratings yet
Using PivotT
36 pages
Membuat Graph Menggunakan Pivot Table
PDF
No ratings yet
Membuat Graph Menggunakan Pivot Table
8 pages
Pivot Tables Explained
PDF
No ratings yet
Pivot Tables Explained
26 pages
DV Unit - VI Notes
PDF
No ratings yet
DV Unit - VI Notes
68 pages
Excel 2013: Pivot Tables
PDF
No ratings yet
Excel 2013: Pivot Tables
18 pages
Advance Function
PDF
No ratings yet
Advance Function
20 pages
Using Excel For Problem Solving - Part II - Pivot Tables: Learning Objectives
PDF
No ratings yet
Using Excel For Problem Solving - Part II - Pivot Tables: Learning Objectives
5 pages
Excel Pivot Tables Step by Step
PDF
No ratings yet
Excel Pivot Tables Step by Step
7 pages