Sunday 30 April 2017

Filtering Data in Microsoft Excel



Filter Data

Using AutoFilter to filter data is a quick and easy way to find and work with a subset of data in a range of cells or table column. Filtered data displays only the rows that meet criteria that you specify and hides rows that you do not want displayed. Criteria are conditions you specify to limit which records are included in the result set of a query or filter. After you filter data, you can copy, find, edit, format, chart, and print the subset of filtered data without rearranging or moving it. You can also filter by more than one column. Filters are additive, which means that each additional filter is based on the current filter and further reduces the subset of data.

Using AutoFilter, you can create three types of filters: by a list values, by a format, or by criteria. Each of these filter types is mutually exclusive for each range of cells or column table. For example, you can filter by cell colour or by a list of numbers, but not by both; you can filter by icon or by a custom filter, but not by both.

Important.

For best results, do not mix storage formats, such as text and number or number and date, in the same column because only one type of filter command is available for each column. If there is a mix of storage formats, the command that is displayed is the storage format that occurs the most. For example, if the column contains three values stored as number and four as text, the filter command that is displayed is Text Filters.

Filtering Text

Range of cells
  1. Select a range of cells containing alphanumeric data.
  2. On the Home tab, in the Editing group, click Sort & Filter, and then click Filter.

Filter buttons appear beside each column heading as shown below:

  1. Click the arrow in the column header and do one of the following:
  2. To select from a list of text values
    1. In the list of text values, select or clear one or more text values to filter by.
    2. The list of text values can be up to 10,000. If the list is large, clear Select All at the top, and then select the specific text values to filter by.
    To create criteria
    1. Point to Text Filters and then click one of the comparison operator such as =, >, <, >=, <=, and <> commands, or click Custom Filter.
    2. For example, to filter by text that begins with a specific character, select Begins With, or to filter by text that has specific characters anywhere in the text, select Contains.
    3. In the Custom AutoFilter dialog box, in the box on the right, enter text or select the text value from the list.

    For example, to filter by text that begins with the letter J, enter "J" or to filter by text that has "bell" anywhere in the text, enter bell.

    If you need to find text that shares some characters but not others, use a wildcard character. `Wild characters and their usage are shown in the table below:

    Use

    To find

    ? (question mark)

    Any single character. For example, sm?th finds "smith" and "smyth".

    * (asterisk)

    Any number of characters. For example, *east finds "Northeast" and "Southeast".

    ~ (tilde) followed by ?, *, or ~

    A question mark, asterisk, or tilde. For example, fy06~? finds "fy06?".

  1. Optionally, filter by one more criteria by doing one of the following:
    1. To filter the table column or selection so that both criteria must be true, select And.
    2. To filter the table column or selection so that either or both criteria can be true, select Or.
    3. In the second entry, select a comparison operator, and then in the box on the right, enter text or select a text value from the list.
  2. Click Ok.

Filtering Numbers

Range of cells
  1. Select a range of cells containing numeric data.
  2. Repeat step 3, 3a and 3b above.
  3. Create criteria
    1. Point to Number Filters and then click one of the comparison operator commands or click Custom Filter.
    2. For example, to filter by a lower and upper number limit, select Between.
    3. In the Custom AutoFilter dialog box, in the box or boxes on the right, enter numbers or select numbers from the list.
    4. For example, to filter by a lower number of 25 and an upper number of 50, enter 25 and 50.
    5. Optionally, filter by one more criteria by repeating step four above.

Filtering Dates or Times

Range of cells
  1. Select a range of cells containing numeric data.
  2. On the Home tab, in the Editing group, click Sort & Filter, and then click Filter.
  3. Click the arrow in the column header.
  4. Select from a list of dates or times
    1. In the list of dates or times, select or clear one or more dates or times to filter by.
    2. By default, all dates in the range of cells or table column are grouped by a hierarchy of years, months, and days. Selecting or clearing a higher level in the hierarchy selects or clears all nested dates below that level. For example, if you select 2006, months are listed below 2006, and days are listed below each month.
    3. Create criteria
    4. Point to Date Filters and then do one of the following:
    5. For a common filter based on a comparison operator;
    6. Click one of the comparison operator commands (Equals, Before, After, or Between) or click Custom Filter.
    7. In the Custom AutoFilter dialog box, in the box on the right, enter a date or time, select a date or time from the list, or click the Calendar button to find and enter a date. For example, to filter by a lower and upper date or time, select Between.
    8. For example, to filter by an earlier date of "3/6/2007" and a later date of "6/12/2007", enter 3/6/2007 and 6/12/2007. Dynamic filter where the criteria can change when you reapply the filter;
    9. Click one of the pre-defined date commands. For example, to filter all dates by the current date, select Today, or by the following month, select Next Month.
  5. Click Ok.

Filtering for Top or Bottom Numbers

Range of cells
  1. Select a range of cells containing numeric data.
  2. On the Home tab, in the Editing group, click Sort & Filter, and then click Filter.
  3. Click the arrow in the column header.
  4. Point to Number Filters and then select Top 10 and in the Top 10 AutoFilter dialog box, do the following:
    1. In the box on the left, click Top or Bottom.
    2. In the box in the middle, enter a number between 1 and 500.
    3. In the box on the right, do one of the following:
      1. To filter by number, click Items.
      2. To filter by percentage, click Percent.
  5. Click Ok.

Filtering by Selection

You can quickly filter data with criteria that is equal to the contents of the active cell.

  1. In a range of cells or table column, right click a cell containing the value, colour, font colour, or icon you want to filter by.
  2. Click Filter, and then do one of the following:
    1. To filter by text, number, or date or time, click Filter by Selected Cell's Value.
    2. To filter by cell colour, click Filter by Selected Cell's Color.
    3. To filter by font colour, click Filter by Selected Cell's Font Color.
    4. To filter by icon, click Filter by Selected Cell's Icon.

Sorting by a Custom List in Excel



Sort by a Custom List in Microsoft Excel

You can use a custom list to sort in a user-defined order. Excel provides built-in, day-of-the-week and month-of-the year custom lists, and you can also create your own custom list.

  1. Select a column of data in a range of cells, or make sure that the active cell is in a table column.
  2. On the Home tab, in the Editing group, click Sort & Filter, and then click Custom Sort.
  3. The Sort dialog box is displayed.
  4. Under Column, in the Sort by or Then by box, select the column that you want to sort by a custom list.
  5. Click the drop down button under Order and select Custom List.
  6. In the Custom Lists dialog box, select the list that you want. Or you can type in you own list by cliking the Add button and typing; for example High, Medium, Low, separated by comma.
  7. Click Ok twice.

Sort Rows

  1. Select a row of data in a range of cells, or make sure that the active cell is in a table column.
  2. On the Home tab, in the Editing group, click Sort & Filter, and then click Custom Sort.
  3. The Sort dialog box is displayed.
  4. Click Options.
  5. In the Sort Options dialog box, under Orientation, click Sort left to right, and then click Ok.
  6. Under Row, in the Sort by box, select the row that you want to sort.
  7. Do one of the following:
  8. By value
    1. Under Sort On, select Values.
    2. Under Order, do one of the following:
      1. For text values, select A to Z or Z to A.
      2. For number values, select Smallest to Largest or Largest to Smallest.
      3. For date or time values, select Oldest to Newest or Newest to Oldest.
    By cell colour, font colour, or cell icon
    1. Under Sortn, select Cell Color, Font Color, or Cell Icon.
    2. Click the arrow next to the button, and then select a cell color, font color, or cell icon.
    3. Under Order, select On Left or On Right.

Sort by more than one Column or Row

You might sort by more than one column or row when you have data that you want to group by the same value in one column or row, and then sort another column or row within that group of equal values. For example, if you have a Department and Employee columns, you can first sort by Department (to group all the employees in the same department together), and then sort by name (to put the names in alphabetical order within each department).

Again, if you want to find a way of categorising employees into a seniority list when such employees have the same date of employment, consider sorting by another column beside the Date Employed column. You can sort by up to 64 columns.

For best results, the range of cells that you sort should have column headings.

  1. Select the entire range of cells with two or more columns of data, or make sure that the active cell is in a table with two or more columns.
  2. On the Home tab, in the Editing group, click Sort & Filter, and then click Custom Sort.
  3. The Sort dialog box is displayed.
  4. Under Column, in the Sort by box, select the first column that you want to sort.
  5. Under Sort On, select the type of sort by doing one of the following:
    1. To sort by text, number, or date and time, select Values.
    2. To sort by format, select Cell Color, Font Color, or Cell Icon.
  6. Under Order, select how you want to sort by doing one of the following:
    1. For text values, select A to Z or Z to A.
    2. For number values, select Smallest to Largest or Largest to Smallest
    3. For date or time values, select Oldest to Newest or Newest to Oldest.
    4. To sort based on a custom list, select Custom List.
  7. To add another column to sort by, click Add Level button, and then repeat steps three through five.
  8. To copy a column to sort by, select the entry, and then click Copy Level.
  9. To delete a column to sort by, select the entry, and then click Delete Level.
  10. You must keep at least one entry in the list that is being used in the sorting.
  11. To change the order in which the columns are sorted, select an entry, and then click the Up or Down arrow to change the order.

General Issues/Problems with Sorting

If you get unexpected results when sorting your data, do the following:

>Check to see if the values returned by a formula have changed. If the data that you have sorted contains one or more formulas, the return values of those formulas can change when the worksheet is recalculated. In this case, make sure that you reapply the sort or do the sort again to get up-to-date results.

Unhide rows and columns before you sort. Hidden columns are not moved when you sort columns, and hidden rows are not moved when you sort rows. Before you sort data, it's a good idea to unhide any hidden columns and rows.

Check the locale setting. Sort orders vary by locale setting. Make sure that you have the proper locale setting in Regional Settings or Regional and Language Options in Control Panel on your computer (details of control panel setting is not covered here).

Enter column headings in only one row. If you need multiple line labels, wrap the text within the cell. Detaigls of text wrapping in cells will be covered in later posts ion this blog, it will be covered under "Editing Workbook."

Turn on or off the heading row. It's usually best to have a heading row when you sort a column to make it easier to understand the meaning of the data. By default, the value in the heading is not included in the sort operation. Occasionally, you may need to turn on or off the heading so that the value in the heading is or is not included in the sort operation. Select 'My data has headers' in the sort dialog box to exclude column headers in the sort data. Then clear 'My data has headers' to include the first row of data in the sorting because it is not a column heading.

Saturday 29 April 2017

Data Sorting in Microsoft Excel



Data Sorting in Microsoft Excel

Sorting data is an integral part of data analysis. You might want to put a list of names in alphabetical order, compile a list of product inventory levels from highest to lowest, or order rows by colours or icons. Sorting data helps you quickly visualize and understand your data better, organize and find the data that you want, and ultimately make more effective decisions. To find the top or bottom values in a range of cells or table, such as top 10 grades or bottom 5 sales amounts, use AutoFilter or conditional formatting.

Sort data in a range or table

You can sort data by text (A to Z or Z to A), numbers (smallest to largest or largest to smallest), and dates and times (oldest to newest and newest to oldest) in one or more columns. You can also sort by a custom list (such as Large, Medium, and Small) or by format, including cell colour, font colour, or icon set. Most sort operations are column sorts, but you can also sort by rows.

Sort criteria are saved with the workbook so that you can reapply the sort each time that you open the workbook for an Excel table, but not for a range of cells. If you want to save sort criteria so that you can periodically reapply a sort when you open a workbook, then it's a good idea to use a table. This is especially important for multicolumn sorts or for sorts that take a long time to create.

In Excel 2007, you can apply sort states with up to sixty-four sort conditions to sort data by, but earlier versions of Excel support sort states with up to three conditions only. To avoid losing sort state information in earlier versions of Excel when the workbook is opened in an earlier version; you may want to change the sort state to one that uses no more than three conditions.

All sort state information remains available in the workbook, even after opening in an earlier version and is applied when the workbook is opened again in Excel 2007, unless the sort state information is edited in the earlier version of Excel.

Sort Text

  1. Select a column of alphanumeric data in a range of cells, or make sure that the active cell is in a table column containing alphanumeric data.
  2. On the Home tab, in the Editing group, and then click Sort & Filter.
  3. Do one of the following:
    1. To sort in ascending alphanumeric order, click Sort A to Z.
    2. To sort in descending alphanumeric order, click Sort Z to A.
    Optionally, you can do a case-sensitive sort.
  4. On the Home tab, in the Editing group, click Sort & Filter, and then click Custom Sort.
  5. In the Sort dialog box, click Options.
  6. In the Sort Options dialog box, select Case sensitive.
  7. Click OK twice.
Note
  1. Ensure that all data is stored as text. If the column that you want to sort contains numbers stored as numbers and numbers stored as text, then you need to format them all as text. If you do not, the numbers stored as numbers are sorted before the numbers stored as text.
  2. To format all of the selected data as text, on the Home tab, in the Font group, click the Format Cell Font button, click the Number tab, and then under Category, click Text.
  3. Remove any leading spaces before sorting the data. In some cases, data imported from another application might have leading spaces inserted before data.

Sort Numbers

  1. Select a column of numeric data in a range of cells, or make sure that the active cell is in a table column containing numeric data.
  2. On the Home tab, in the Editing group, click Sort & Filter, and then do one of the following:
    1. To sort from low numbers to high numbers, click Sort Smallest to Largest.
    2. To sort from high numbers to low numbers, click Sort Largest to Smallest.
    Important

    Check to ensure that all numbers are stored as number. If the results are not what you expected, the column might contain numbers stored as text and not as numbers. For example, negative numbers imported from some accounting systems or a number entered with a leading ' (apostrophe) are stored as text. For more information, see Convert numbers stored as text to numbers in Section five of this book.

    Sort Dates or Times

    1. Select a column of dates or times in a range of cells, or make sure that the active cell is in a table column containing dates or times.
    2. On the Home tab, in the Editing group, click Sort & Filter, and then do one of the following:
      1. To sort from an earlier to a later date or time, click Sort Oldest to Newest.
      2. To sort from a later to an earlier date or time, click Sort Newest to Oldest.
    Important
    1. Check that dates and times are stored as dates or times. If the results are not what you expected, the column might contain dates or times stored as text and not as dates or times. For Excel to sort dates and times correctly, all dates and times in a column must be stored as a date or time serial number. If Excel cannot recognize a value as a date or time, the date or time is stored as text. You can also see Section five on how to convert dates stored as text to dates.
    2. If you want to sort by days of the week, format the cells to show the day of the week. If you want to sort by the day of the week regardless of the date, convert them to text by using the TEXT function. However, the TEXT function returns a text value, and so the sort operation would be based on alphanumeric data.

    Sort by Cell Colour, Font Colour or Icon

    If you have manually or conditionally formatted a range of cells or table column, by cell colour or font colour, you can also sort by these colours. You can also sort by an icon set created through a conditional format.
    1. Select a column of data in a range of cells, or make sure that the active cell is in a table column.
    2. On the Home tab, in the Editing group, click Sort & Filter, and then click Custom Sort.
    3. The Sort dialog box is displayed.
    4. Under Column, in the Sort by box, select the column that you want to sort.
    5. Under Sort On, select the type of sort.
    6. Do one of the following:
      1. To sort by cell colour, select Cell Color.
      2. To sort by font colour, select Font Color.
      3. To sort by an icon set, select Cell Icon.
    7. Under Order, select how you want to sort.
    8. Do one of the following:
      1. To move the cell colour, font colour, or icon to the top or left, select On Top for a column sort, and On Left for a row sort.
      2. To move the cell colour, font colour, or icon to the bottom or right, select On Bottom for a column sort and On Right for a row sort.
    9. To specify the next cell colour, font colour, or icon to sort by, click Add Level, and then repeat steps four through five.
    10. Make sure that you select the same column in the Then by box and that you make the same selection under Order.
    11. Keep repeating steps five through six for each additional cell colour, font colour, or icon that you want included in the sort.
    12. Click Ok.

Monday 10 April 2017

Protecting a Shared Workbook



If the workbook you want to protect is shared

  1. If the workbook is already shared and you want to assign a password to protect the sharing, you must first unshare the workbook by doing the following:
    1. Have all other users save and close the shared workbook to avoid losing their work.
    2. To keep a copy of the change history information that is usually lost when you unshare a workbook, do the following:
      1. Click on the Review tab, in the Changes group, click Track Changes, and then click Highlight Changes.
      2. In the When list, select All.
      3. Clear the Who and Where check boxes.
      4. Select the List changes on a new sheet check box, and then click OK.
      5. Print the History worksheet or copy the history to another workbook.
    Change history is the information that is maintained about changes made in past editing sessions of a shared workbook. The information includes the name of the person who made each change, when the change was made, and what data was changed.
  2. In the shared workbook, on the Review tab, in the Changes group, click Share Workbook.
  3. On the Editing tab, make sure that you are the only person listed in the 'Who has this workbook open now' list.
  4. Clear the 'Allow changes by more than one user at the same time. This also allows workbook merging' check box. If this check box is not available, then you must unprotect the workbook before clearing the check box.
  5. Clic Ok. When you are prompted about the effects on other users, click Yes.
  6. If needed, give specific users access to ranges, protect worksheets, protect workbook elements, and set passwords for viewing and editing.
  7. If prompted, save the workbook.

To Unprotect Workbook

  1. Click on the Review tab, in the Changes group, click 'Unprotect Workbook.'
  2. If you are prompted, enter the password and then click OK.