Formatting Cells and Ranges

Chapter 4: Formatting Cells and Ranges

Learning Objectives

  1. Paste with Paste Special options, fill cells with Auto Fill, and insert and delete multiple rows, columns and cells.
  2. Generate numbers with RANDBETWEEN and SEQUENCE.
  3. Merge and unmerge cells, change alignment, orientation and indentation, wrap text, and use Format Painter.
  4. Apply number formats, Format Cells options and cell styles, clear formatting, and format several worksheets at once by grouping them.
  5. Define named ranges and use them in formulas, and insert and format sparklines.

Introduction to Excel taught you to enter data, format it and fill formulas down a column. The MO-210 exam goes further. It expects you to choose exactly what to paste, generate numbers with functions, use every alignment and number-format option, format many sheets at once, name ranges, and add small in-cell charts called sparklines. This chapter covers each of those skills.

4.1 Paste Special and Auto Fill

4.1.1 Paste Special

A regular paste copies everything about a cell: its value or formula, its formatting, its comments and its validation. Paste Special pastes only the parts you choose. Copy the cells, select the destination, then either click the arrow under Home › Paste for a gallery of options or choose Paste Special (Ctrl+Alt+V) for the full dialog box.

The options you'll use most:

Option Pastes Typical use
Values Results only, no formulas or formatting Turn formulas into fixed numbers
Values & Number Formatting Results with their number formats Fixed numbers that still look like currency or percentages
Formulas Formulas, without formatting Reuse a calculation in a differently formatted area
Formatting Formatting only Copy a look, like Format Painter
Keep Source Column Widths Everything, plus the source column widths Keep a pasted table's column widths
Transpose Everything, with rows and columns swapped Turn a column into a row
Paste Link A formula that refers to the source cell (=Sheet1!B2) Keep the destination in sync with the source
Picture / Linked Picture An image of the cells Put a snapshot of a range on a dashboard

The Paste Special dialog box also has an Operation section. Add, Subtract, Multiply and Divide combine the copied value with the values already in the destination. To raise every price in a column by 5 percent, type 1.05 in a spare cell, copy it, select the prices, and choose Paste Special › Values › Multiply. Skip blanks leaves destination cells alone wherever the copied range is empty.

Exam tasks describe the paste, not the option. "Copy the totals to the Archive sheet so they won't change when the source data changes" means Values. "Copy the list so that the months run across row 1" means Transpose. "Copy the range so that it updates when the original changes" means Paste Link.

4.1.2 Auto Fill

Introduction to Excel introduced the fill handle, the small square at the bottom right of a selection. Drag it to copy a value or formula, or to continue a series. Here are a few more details for the exam:

Chapter 9 covers the Series dialog box and Flash Fill, which are on MO-211.

4.2 Inserting and deleting cells, rows and columns

4.2.1 Several rows or columns at once

To insert several rows at once, select that many rows by dragging across their row headings, then right-click and choose Insert. Excel inserts the same number of rows above the selection. Columns work the same way and are inserted to the left. To delete rows or columns, select them and choose Delete.

You can also use Home › Insert › Insert Sheet Rows or Insert Sheet Columns, and Home › Delete. Ctrl++ (Ctrl and the plus sign) inserts and Ctrl+- deletes.

4.2.2 Inserting and deleting cells

Inserting a cell (instead of a whole row or column) pushes nearby cells out of the way. Select the cells where the new ones should go and choose Home › Insert › Insert Cells. Excel asks how to make room:

Home › Delete › Delete Cells works the other way: Shift cells left or Shift cells up closes the gap.

Shifting cells moves only the cells in the selected rows or columns, so it can pull data in neighboring columns out of line with the rest of its row. Check the result. If a task says "insert a cell" and names a direction, use Insert Cells, not Insert Sheet Rows.

4.3 Generating numbers

Two MO-210 functions create numbers instead of calculating them from your data.

4.3.1 RANDBETWEEN

RANDBETWEEN(bottom, top) returns a random whole number from bottom to top, including both. For example, =RANDBETWEEN(1, 100) returns a number from 1 to 100.

RANDBETWEEN is volatile: it picks a new number every time the worksheet recalculates, which happens whenever you change anything. To keep a set of random numbers, copy them and paste them back as Values.

4.3.2 SEQUENCE

SEQUENCE(rows, [columns], [start], [step]) returns a list of numbers in order. It's a dynamic array function: you type it in one cell, and the results spill into the cells below and to the right.

Formula Result
=SEQUENCE(5) 1, 2, 3, 4, 5 down a column
=SEQUENCE(1, 12) 1 through 12 across a row
=SEQUENCE(10, 1, 100, 10) 100, 110, 120 … 190 down a column
=SEQUENCE(3, 4) 1 through 12 in a 3-row, 4-column block, filling across first

The spilled results have a blue border when you select any of them. Only the first cell holds the formula. The rest show the formula grayed out in the formula bar and can't be edited on their own. If something is in the way, the formula returns #SPILL!. Clear the blocking cells and the results appear.

Tasks may not name these functions. "Generate a whole number between 1 and 6 that changes each time the worksheet recalculates" means RANDBETWEEN. "Use a formula in A2 to number the rows 1 through 50" means SEQUENCE.

4.4 Alignment and text control

The Home tab's Alignment group, and the Alignment tab of Format Cells (Ctrl+1), control where text sits in a cell.

4.4.1 Merging and unmerging

The Merge & Center button's arrow has four choices:

Only the upper-left cell's value is kept when you merge. Excel warns you if other cells have data.

Merged cells cause trouble when sorting, filtering or selecting columns, and the Accessibility Checker flags them. To center a title over several columns without merging, select the cells, open Format Cells › Alignment, and choose Horizontal: Center Across Selection.

4.4.2 Alignment, orientation and indentation

Setting Where
Vertical alignment (top, middle, bottom) Top Align, Middle Align, Bottom Align buttons
Horizontal alignment (left, center, right) Align Left, Center, Align Right buttons
Indentation Increase Indent and Decrease Indent, or the Indent box in Format Cells
Orientation The Orientation button: Angle Counterclockwise, Angle Clockwise, Vertical Text, Rotate Text Up, Rotate Text Down
An exact angle Format Cells › Alignment › Orientation, with a value from -90 to 90 degrees

4.4.3 Wrap text and Shrink to fit

Wrap Text shows a long entry on several lines inside its cell, and the row grows taller to fit. To start a new line at an exact spot while you type, press Alt+Enter.

Shrink to fit (Format Cells › Alignment) makes the font smaller so the entry fits on one line in the cell. You can't use it together with Wrap Text.

4.5 Number formats, cell styles and Format Painter

4.5.1 Number formats

A number format changes how a value looks without changing the value itself. The Number Format list in Home's Number group has the common formats:

Format 1234.5 looks like Notes
General 1234.5 The default
Number 1234.50 Two decimal places by default
Currency $1,234.50 Symbol next to the number
Accounting $ 1,234.50 Symbol at the left edge of the cell; zeros show as a dash
Short Date / Long Date 5/18/1903 / Monday, May 18, 1903 Dates are stored as numbers
Percentage 123450.00% Multiplies by 100 for display
Fraction 1234 1/2
Scientific 1.23E+03
Text 1234.5 Treats the entry as text

The buttons below the list apply Accounting Number Format (its arrow chooses other currencies), Percent Style, Comma Style (Accounting without the symbol), and Increase Decimal and Decrease Decimal.

4.5.2 The Format Cells dialog box

Format Cells (Ctrl+1, or the launcher in the Number, Font or Alignment group) has every formatting option in six tabs: Number, Alignment, Font, Border, Fill and Protection. Use it when a task asks for something the ribbon doesn't offer directly, such as:

4.5.3 Cell styles

A cell style is a named set of formats: font, fill, borders, number format and alignment. Home › Cell Styles shows the built-in styles in groups:

Point at a style to preview it, and click to apply it. To create your own, format a cell the way you want, then choose Cell Styles › New Cell Style and give it a name. To change a style everywhere it's used, right-click it in the gallery and choose Modify.

4.5.4 Format Painter

Format Painter (Home › Format Painter, the paintbrush) copies formatting from one cell to others:

  1. Select the cell whose formatting you want.
  2. Click Format Painter, then click or drag over the destination cells.

Double-click Format Painter to keep it on so you can paint several ranges. Press Esc or click the button again to turn it off.

4.5.5 Clearing formatting

Home › Clear (the eraser) removes parts of a cell:

Choice Removes
Clear All Contents, formats, comments and notes
Clear Formats Formatting only; the values stay
Clear Contents Values and formulas; the formatting stays (same as pressing Delete)
Clear Comments and Notes Comments and notes only
Clear Hyperlinks / Remove Hyperlinks The link; Clear keeps the link's formatting, Remove takes it off too

4.6 Formatting grouped worksheets

When several sheets share the same layout, such as one sheet per month, you can group them and change them all at once. Anything you do to the active sheet while they're grouped happens on every sheet in the group, in the same cells: typing, formatting, inserting rows, page setup and headers and footers.

The title bar shows [Group] while sheets are grouped. To ungroup, right-click a tab and choose Ungroup Sheets, or click a tab that isn't in the group.

To copy content and formatting that already exists on one sheet to the others, group the sheets, select the range on the sheet that has it, and choose Home › Fill › Across Worksheets. Then choose All, Contents or Formats.

Forgetting to ungroup is a common mistake, on the exam and at work. Every change you make while grouped lands on every sheet in the group. Ungroup as soon as the grouped task is done.

4.7 Named ranges

A named range (or defined name) gives a cell or range a meaningful name, such as TaxRate or Q1_Sales. You can use the name in formulas instead of the address, as in =Subtotal*TaxRate, and pick it from the Name Box to jump to it.

4.7.1 Naming rules

4.7.2 Defining a name

There are three ways to name a range:

Scope decides where a name works. A name with Workbook scope can be used on any sheet. A name scoped to one worksheet can be used only on that sheet without a sheet prefix. Unless a task says otherwise, leave the scope as Workbook.

4.7.3 Using and managing names

A task such as "Create a name for cells B2:B13 called Monthly_Sales" can be done any of these ways. Check the spelling, including underscores and capital letters. Excel ignores capitalization, but a grader comparing the text may not.

4.8 Sparklines

A sparkline is a tiny chart inside one cell. It shows the trend in a row or column of numbers beside the numbers themselves.

4.8.1 Inserting sparklines

  1. Select the cells where the sparklines should go, usually an empty column next to the data, one cell per row.
  2. Choose Insert › Sparklines and one of the three types:
    • Line shows a trend over time.
    • Column compares values as small bars.
    • Win/Loss shows only whether each value is positive or negative.
  3. In the Create Sparklines dialog box, enter the Data Range (for example, B2:M10). The Location Range is the cells you selected. Click OK.

Excel creates one sparkline per row of data and groups them, so formatting one formats them all.

4.8.2 Formatting sparklines

Select a sparkline to see the Sparkline tab:

Group Use it to
Sparkline Edit Data to change the data or location range.
Type Switch between Line, Column and Win/Loss.
Show Highlight the High Point, Low Point, Negative Points, First Point and Last Point, and show Markers (line sparklines only).
Style Choose a style, and set the Sparkline Color and Marker Color.
Group Axis options, such as giving every sparkline the same minimum and maximum so they can be compared; Group and Ungroup; Clear to delete sparklines.

Deleting a cell's contents doesn't remove its sparkline. Select the sparkline and choose Sparkline › Clear, or use Clear Selected Sparkline Groups to remove the whole group.

4.9 Practice

Simmy assessment goes here. Exam-style tasks on Paste Special, Auto Fill, inserting cells, RANDBETWEEN and SEQUENCE, alignment, number formats, cell styles, Format Painter, grouped sheets, named ranges and sparklines. When a student misses a task, Simmy builds the AI prompt (the task as worded, what the student did, and the correct result).

Starting data. A workbook named Cedar Valley Farmers Market with four sheets: Summary, June, July and August.

Summary (A1:H9). A1 holds "Vendor Sales Summary". Row 3 is headings: Vendor (A), Jun (B), Jul (C), Aug (D), Total (E, =SUM(B4:D4)), and Trend (F, empty). Rows 4–9:

Vendor Jun Jul Aug Total
Hilltop Honey 2,140 2,615 2,380 =SUM(B4:D4)
Green Acres Produce 4,920 5,410 6,050 =SUM(B5:D5)
Rolling Pin Bakery 3,310 3,050 3,480 =SUM(B6:D6)
Sunrise Eggs 1,280 1,195 1,340 =SUM(B7:D7)
Mesa Flowers 1,870 2,240 1,990 =SUM(B8:D8)
Creekside Cheese 2,560 2,710 2,905 =SUM(B9:D9)

H1 holds the value 1.03.

June, July, August each have the same layout: A1 "Daily Receipts" (unformatted), row 3 headings Date, Vendor, Amount, and about 30 rows of data. Column C (Amount) is in General format.

Tasks.

  1. On the Summary worksheet, center the title in cell A1 across columns A through F without merging the cells. Expected result: A1:F1 Horizontal alignment = Center Across Selection; no merged cells. Objective: Modify cell alignment, orientation, and indentation.
  2. Apply the Heading 2 cell style to cells A3:F3 of the Summary worksheet, and rotate the text in B3:D3 so it angles upward from left to right. Expected result: A3:F3 style Heading 2; B3:D3 orientation 45° (Angle Counterclockwise). Objective: Apply cell styles; Modify cell alignment, orientation, and indentation.
  3. Increase all values in B4:D9 by 3 percent by using the value in cell H1. Do not use formulas. Expected result: B4:D9 are constants equal to the original values × 1.03 (for example, B4 = 2204.2). Objective: Paste data by using special paste options.
  4. In F4:F9, insert line charts that each fit in one cell and show the trend from June to August for each vendor. Mark the highest point. Expected result: line sparklines in F4:F9 with data range B4:D9; High Point shown. Objective: Insert Sparklines.
  5. Create a name for cells E4:E9 called Vendor_Totals. In cell E11, enter a formula that uses the name to calculate the total of all vendors. Expected result: defined name Vendor_Totals = Summary!$E4:4:E$9 (workbook scope); E11 = =SUM(Vendor_Totals). Objective: Define a named range; Reference a named range.
  6. On the June, July and August worksheets at the same time, apply the Title cell style to cell A1 and format the values in column C as Currency with two decimal places. Expected result: on all three sheets, A1 style Title and C4:C33 Currency, 2 decimals; sheets ungrouped afterward. Objective: Format multiple worksheets by grouping; Apply number formats.
  7. In cell J3 of the Summary worksheet, enter a formula that returns the numbers 1 through 6 in J3:J8. Expected result: J3 = =SEQUENCE(6) spilling to J8. Objective: Generate numeric data by using SEQUENCE().
  8. On the Summary worksheet, copy the formatting of cell A3 to cells A11:B11. Expected result: A11:B11 have A3's formatting (Heading 2 style); their contents are unchanged. Objective: Format cells by using Format Painter.
  9. Insert two cells at B4:B5 of the June worksheet, shifting the existing cells down. Expected result: the June sheet's original B4:B33 values now start at B6; columns A and C are unchanged. Objective: Insert and delete cells.