Categories
Excel Training

Insert a Sub-Total in excel 2010

You can use Excel 2007’s Subtotals feature to subtotal data in a sorted list. To subtotal a list, you first sort the list on the field for which you want the subtotals, and then you designate the field that contains the values you want to be summed — these don’t have to be the same fields in the list.

Excel does not allow you to subtotal a list formatted as a table. You must first convert your table into a normal range of cells. Click a cell in the table and then click the Table Tools Design tab. Click the Convert to Range button in the Tools group, and then click Yes. Excel removes the filter buttons from the columns at the top of the data list while still retaining the original table formatting.

Follow these steps to add subtotals to a list in a worksheet:

  1. Sort the list on the field for which you want subtotals inserted.
  2. Click the Subtotal button in the Outline group on the Data tab.The Subtotal dialog box appears.

    Use the Subtotal dialog box to specify the options for the subtotals.

    Use the Subtotal dialogue box to specify the options for the subtotals.
  3. Select the field for which the subtotals are to be calculated in the At Each Change In drop-down list.
  4. Specify the type of totals you want to insert in the Use Function drop-down list.When you use the Subtotals feature, you aren’t restricted to having the values in the designated field added together with the SUM function. You can instead have Excel return the number of entries with the COUNT function, the average of the entries with the AVERAGE function, the highest entry with the MAX function, the lowest entry with the MIN function, or even the product of the entries with the PRODUCT function.
  5. Select the check boxes for the field(s) you want to total in the Add Subtotal To list box.
  6. Click OK.Excel adds the subtotals to the worksheet.
    The bottom of a list showing the subtotals and a grand total.

When you use the Subtotals command, Excel outlines the data at the same time that it adds the rows with the departmental salary totals and the grand total. This means that you can collapse the data list down to just its departmental subtotal rows or even just the grand total row simply by collapsing the outline down to the second or first level.

In a large list, you may want Excel to insert page breaks every time data changes in the field on which the list is being subtotaled (that is, the field designated in the At Each Change In drop-down list box). To do this, you select the Page Break between Groups check box in the Subtotal dialogue box before you click OK to subtotal the list.

Categories
Excel Training

How to: Calculate your age in days and whole years in Excel

This technique can be used to calculate the difference between any two dates.  The worked example shows calculating age and showing this in days and in whole years.  It involves using the TODAY and TRUNCATE functions and nesting several functions together.

  • Create a table for showing date of birth for required people – start this in row 3
  • In cell A1, input the Today function (the today function is always =TODAY() , but can also be inserted using the Formulas tab and is in the Date & Time group)

Your Sheet will now look something like this: 

  • To calculate age in days, subtract the date of birth from todays date. To enable you to copy the formula to all rows you should use an absolute cell reference to cell A1.  Your formula will read =$A$1-A4
  • To convert this into years, you need to divide the age in days by 365.25, so your formula will read =C4/365.25  Were you to use formatting to turn this into whole year (i.e. format the cell to a number showing 0 decimal places, anyone over 6 months towards their next birthday would become a year older!  So we need to truncate the number, removing everything after the decimal point and only using the whole years.
  • The Truncate function is =TRUNC(Number to truncate, no of decimal places to keep). In the example we want to truncate C4/365.25, but haven’t yet put the formula into a cell, as I want just the one formula, so my formula in D4 will be =TRUNC(C4/365.25,0)
  • If I wanted to only display age in full years, I could not hide column C or I could have put the whole calculation in one cell, giving a formula of  =TRUNC(($A$1-A4)/365.25,0)
  • Example 1 below shows the two column solution and Example 2 the one column solution
    Example 1
    Example 2

    On 17th October 2011, these are the answers