Advanced Data Management

Chapter 9: Advanced Data Management

Learning Objectives

  1. Fill cells with Flash Fill and with the Series dialog box's advanced options, and generate random numbers with RANDARRAY.
  2. Create custom number formats with sections, colors, conditions and text.
  3. Configure data validation rules, input messages and error alerts.
  4. Group and ungroup data, insert subtotals, and remove duplicate records.
  5. Create, edit and manage custom conditional formatting rules, including rules that use formulas.

The Manage and format data domain is the largest part of MO-211, about a third of the exam. It covers tools for filling, formatting, checking and organizing data that go beyond the everyday ones. You'll fill cells by example, design your own number formats, stop bad data from being entered, collapse data into outlines with subtotals, remove duplicates, and write conditional formatting rules of your own instead of choosing from the built-in list.

9.1 Flash Fill and advanced fill series

9.1.1 Flash Fill

Flash Fill fills a column by following an example you type. It's the quickest way to split, combine or reformat text without writing a formula. Suppose column A holds names like Torres, Maya:

  1. In B2, type the result you want for the first row, such as Maya.
  2. Choose Data › Flash Fill (or Home › Fill › Flash Fill), or press Ctrl+E.

Excel fills the rest of the column by following the same pattern. If it guesses wrong, type a second example in B3 and run Flash Fill again.

Flash Fill can:

Flash Fill types values, not formulas. If the source data changes, the filled column doesn't update. Also, the column you fill must be next to the data, with no blank column between, so Excel can see the pattern.

9.1.2 The Series dialog box

The fill handle continues simple series. The Series dialog box gives exact control. Select the starting cell (or the range to fill), then choose Home › Fill › Series:

Setting Choices
Series in Rows (fill across) or Columns (fill down).
Type Linear adds the step value each time (10, 20, 30). Growth multiplies by it (2, 4, 8). Date steps by a date unit. AutoFill works like the fill handle.
Date unit For dates: Day, Weekday (skips Saturdays and Sundays), Month or Year.
Step value The amount to add or multiply by each time. Negative values count down.
Stop value The value to stop at. With a stop value, you only need to select the first cell.
Trend Fits a straight line (Linear) or curve (Growth) to the values you selected and extends it, instead of using a step.

For example, to list the first day of every month in 2028 down column A: type 1/1/2028 in A2, select A2, choose Fill › Series, then choose Columns, Date, Month, step 1 and stop 12/1/2028.

You can also right-drag the fill handle. When you release the mouse button, a menu offers Fill Weekdays, Fill Months, Linear Trend, Growth Trend and Series.

"Fill A2:A30 with dates that skip weekends" means Date unit: Weekday. "Fill the column with values that double each row, up to 1,024" means Type: Growth, step 2, stop 1024.

9.2 RANDARRAY

RANDARRAY([rows], [columns], [min], [max], [whole_number]) returns an array of random numbers that spills like SEQUENCE.

Argument Meaning Default
rows, columns How many rows and columns of numbers 1 and 1
min, max The smallest and largest possible values 0 and 1
whole_number TRUE for whole numbers, FALSE for decimals FALSE
Formula Result
=RANDARRAY(5) Five decimals between 0 and 1 down a column
=RANDARRAY(10, 1, 1, 100, TRUE) Ten whole numbers from 1 to 100
=RANDARRAY(4, 3, 50, 75) A 4-by-3 block of decimals between 50 and 75

Like RANDBETWEEN, RANDARRAY is volatile and returns new numbers whenever the worksheet recalculates. To keep them, copy the spilled range and paste it back as values.

RANDBETWEEN (chapter 4, MO-210) returns one whole number. RANDARRAY returns a whole block of numbers, whole or decimal, from one formula.

9.3 Custom number formats

When none of the built-in formats fits, write your own. Open Format Cells (Ctrl+1), choose the Number tab, choose Custom, and type a format code in the Type box. The sample above it shows the result. A custom format, like any number format, changes only how the value looks, not the value itself.

9.3.1 Digit placeholders and symbols

Code Meaning 1234.5 in … shows
0 A digit, showing zeros 00000.00 → 01234.50
# A digit, without extra zeros #.## → 1234.5
? A digit, with spaces in place of extra zeros (lines up decimals) #.?? → 1234.5 (with a space)
, between digits Thousands separator #,##0 → 1,235
, at the end Divides by 1,000 for display #,##0.0,"K" → 1.2K
"text" Shows the text as typed 0" units" → 1235 units
@ Stands for text typed in the cell "Dept: "@ shows Dept: Sales for Sales
_ followed by a character Adds a space the width of that character #,##0_) lines up with numbers in parentheses
* followed by a character Repeats the character to fill the cell $* #,##0 puts the $ at the left edge

9.3.2 Sections

A format can have up to four sections separated by semicolons:

positive ; negative ; zero ; text

For example, #,##0;(#,##0);"–";@ shows positive numbers normally, negative numbers in parentheses, zero as a dash, and text as typed. If you give only two sections, the first applies to positive numbers and zero.

9.3.3 Colors and conditions

Put a color name in square brackets at the start of a section: [Black], [Blue], [Cyan], [Green], [Magenta], [Red], [White] or [Yellow].

[Blue]#,##0;[Red](#,##0);[Black]0

A condition in square brackets replaces the usual positive/negative rule:

[Red][<60]0" - Fail";[Green][>=90]0" - Excellent";0

This shows scores under 60 in red with - Fail, scores of 90 or more in green with - Excellent, and other scores plainly.

9.3.4 Dates and times

Code Shows Code Shows
d 7 m 3
dd 07 mm 03
ddd Sun mmm Mar
dddd Sunday mmmm March
yy 27 yyyy 2027
h / hh Hours mm after h Minutes
ss Seconds AM/PM 12-hour clock
[h] Elapsed hours beyond 24 [mm] Elapsed minutes

So dddd, mmmm d, yyyy shows Sunday, March 7, 2027, and [h]:mm shows a total of 30 hours as 30:00 instead of 6:00.

Custom formats you create are saved in the workbook and listed at the bottom of the Custom category. When a task describes a format, such as "Display the values in thousands, followed by the letter K," build it in the Type box and check the sample before clicking OK.

9.4 Data validation

Data validation controls what people can type in a cell. It can limit entries to numbers in a range, dates in a period, items from a list, or anything a formula approves, and it shows a message or an error when someone tries something else.

Select the cells and choose Data › Data Validation. The dialog box has three tabs.

9.4.1 Settings

The Allow list sets the kind of entry:

Allow Use it to Example
Any value Remove a restriction (the default)
Whole number Allow whole numbers in a range between 1 and 10
Decimal Allow any number in a range greater than or equal to 0
List Allow only items from a list, with a drop-down arrow Pending,Approved,Denied or =$H$2:$H$5
Date Allow dates in a range between 1/1/2027 and 12/31/2027
Time Allow times in a range between 8:00 AM and 6:00 PM
Text length Limit the number of characters equal to 5
Custom Allow entries that make a formula TRUE =COUNTIF($A:$A,A2)=1 (no duplicates)

For most types, the Data list chooses the comparison: between, not between, equal to, greater than and so on. Then fill in the values, which can be numbers, cell references or formulas.

For a List, type the items in Source separated by commas, or select a range. Check In-cell dropdown to show the arrow. Ignore blank allows the cell to be left empty.

9.4.2 Input Message

The Input Message tab shows a note whenever someone selects the cell, such as "Enter the number of nights (1–14)." Type a Title and an Input message.

9.4.3 Error Alert

The Error Alert tab sets what happens when someone types something not allowed. Choose a Style:

Type a Title and an Error message to replace Excel's generic one.

9.4.4 Finding and removing validation

Validation tasks often list several details at once: "Allow only whole numbers from 1 to 14 in C2:C50. Display the message Invalid number of nights in a stop alert titled Nights." Check each tab before clicking OK: the rule on Settings, and the style, title and message on Error Alert.

9.5 Grouping, subtotals and removing duplicates

9.5.1 Grouping and outlines

Grouping rows or columns lets you collapse them into one summary line and expand them again. Excel adds an outline at the left (for rows) or above (for columns), with:

To group rows, select the detail rows (not the summary row) and choose Data › Group › Group, or press Shift+Alt+Right Arrow. To ungroup, select them and choose Data › Ungroup, or press Shift+Alt+Left Arrow.

Other outline commands:

9.5.2 Subtotals

The Subtotal command inserts a subtotal row for each group of records and a grand total at the end, and it outlines the result automatically. It works on a sorted range, not a table.

  1. Sort the data by the column you want to group by, such as Region.
  2. Click a cell in the data and choose Data › Subtotal.
  3. Set the options:
    • At each change in: the column you sorted by.
    • Use function: Sum, Count, Average, Max, Min and so on.
    • Add subtotal to: the columns to total.
    • Replace current subtotals: uncheck it to add a second set of subtotals, such as averages under sums.
    • Page break between groups and Summary below data.
  4. Click OK.

Excel inserts rows with the SUBTOTAL function, such as =SUBTOTAL(9,D2:D14), and a grand total row. Use the outline's level buttons to see only the grand total (level 1), the subtotals (level 2) or everything (level 3). To remove the subtotals, open Data › Subtotal again and click Remove All.

If the data is a table, Subtotal is grayed out. Convert the table to a range first (Table Design › Convert to Range), or use the table's total row instead. And always sort first: Subtotal adds a row at every change in the column, so unsorted data gets a subtotal after nearly every record.

9.5.3 The SUBTOTAL function

The rows that the Subtotal command inserts, and a table's total row, use the SUBTOTAL function. Its first argument picks the calculation:

Calculation Includes manually hidden rows Ignores manually hidden rows
AVERAGE 1 101
COUNT 2 102
COUNTA 3 103
MAX 4 104
MIN 5 105
SUM 9 109

Both sets ignore rows hidden by a filter. SUBTOTAL also ignores other SUBTOTAL results in its range, so a grand total doesn't count the subtotals twice.

9.5.4 Removing duplicate records

Remove Duplicates deletes rows that repeat other rows. Click a cell in the data and choose Data › Remove Duplicates (or Table Design › Remove Duplicates in a table):

Excel keeps the first occurrence and removes later ones.

Remove Duplicates deletes data permanently, except with Undo. Read the task for which columns define a duplicate. "Remove records with duplicate customer IDs" means check only the Customer ID column.

9.6 Custom conditional formatting rules

Lesson 8 of Introduction to Excel covered the built-in conditional formats: highlight rules, top/bottom rules, data bars, color scales and icon sets. MO-211 adds custom rules, which you create in the New Formatting Rule dialog box, and rules that use formulas.

9.6.1 Creating a custom rule

Select the cells and choose Home › Conditional Formatting › New Rule. Pick a rule type:

Rule type Use it to
Format all cells based on their values Build a color scale, data bar or icon set with your own colors, types and thresholds. For icon sets, you can set each icon's value and type (number, percent, formula, percentile) and choose Show Icon Only.
Format only cells that contain Format by value (between, greater than…), specific text, dates occurring, blanks or errors.
Format only top or bottom ranked values Format the top or bottom n items or n percent.
Format only values that are above or below average Including one, two or three standard deviations above or below.
Format only unique or duplicate values Highlight duplicates or values that appear once.
Use a formula to determine which cells to format Format cells wherever a formula is TRUE.

Click Format to choose the number format, font, border and fill.

9.6.2 Rules that use formulas

A formula rule formats each cell where the formula returns TRUE. Write the formula as if for the top-left cell of the selection. Excel adjusts it for every other cell, just as if you'd copied it.

The dollar signs decide what the formula looks at:

The most common mistake is the wrong dollar signs. =E2>1000 (no $) applied to A2:F50 makes each cell look at the cell four columns to its right, so the rows won't format correctly. To format whole rows, lock the column ($E2) and leave the row free.

9.6.3 Managing rules

Home › Conditional Formatting › Manage Rules opens the Conditional Formatting Rules Manager:

To remove rules, use Delete Rule here, or Conditional Formatting › Clear Rules › from Selected Cells or from Entire Sheet.

"Change the existing rule so that it also applies to column G" is done in the Rules Manager by editing Applies to, not by creating a new rule. "Ensure the red rule takes precedence over the yellow rule" means moving the red rule above the yellow one.

9.7 Practice

Simmy assessment goes here. Exam-style tasks on Flash Fill, the Series dialog box, RANDARRAY, custom number formats, data validation, grouping, subtotals, Remove Duplicates and custom conditional formatting rules. 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 Blue Heron Lodge with sheets Bookings, Guests and Calendar.

Bookings (A1:G21), a plain range sorted by BookingID:

BookingID Guest Room Type Check-in Nights Rate Total
BH-301 Torres, Maya Suite 7/2/2027 3 289 =E2*F2
BH-302 Okafor, Liam Standard 7/2/2027 2 149 =E3*F3
BH-303 Chen, Ava Deluxe 7/3/2027 4 199 =E4*F4
BH-304 Patel, Noah Standard 7/3/2027 1 149 =E5*F5
BH-305 Lindqvist, Zoe Suite 7/4/2027 5 289 =E6*F6
BH-306 Brooks, Eli Deluxe 7/4/2027 2 199 =E7*F7
BH-307 Romero, Isla Standard 7/5/2027 3 149 =E8*F8
BH-308 Fitzgerald, Owen Deluxe 7/5/2027 6 199 =E9*F9
BH-309 Nakamura, Ruby Suite 7/6/2027 2 289 =E10*F10
BH-310 Adeyemi, Leo Standard 7/6/2027 4 149 =E11*F11
BH-311 Kowalczyk, Maya Deluxe 7/7/2027 3 199 =E12*F12
BH-312 Gallagher, Finn Standard 7/7/2027 7 149 =E13*F13
BH-313 Delgado, Ivy Suite 7/8/2027 1 289 =E14*F14
BH-314 Huang, Jack Deluxe 7/8/2027 2 199 =E15*F15
BH-315 Morales, Ana Standard 7/9/2027 3 149 =E16*F16
BH-316 Singh, Ravi Suite 7/9/2027 4 289 =E17*F17
BH-317 Walsh, Nora Standard 7/10/2027 2 149 =E18*F18
BH-318 Ito, Ken Deluxe 7/10/2027 5 199 =E19*F19
BH-319 Haddad, Lina Standard 7/11/2027 1 149 =E20*F20
BH-320 Moreau, Luc Suite 7/11/2027 3 289 =E21*F21

Guests (A1:C26): a guest list with columns Email, Name, Loyalty Tier; 25 rows, of which 4 are exact repeats of earlier rows and 2 more share an email with an earlier row but have a different tier.

Calendar: A1 "Week of"; A2 holds 7/5/2027; A3:A20 empty. C1 "Sample".

Tasks.

  1. On the Bookings worksheet, insert a column to the right of Guest named First Name. Fill it with each guest's first name by following an example, without using a formula. Expected result: new column C "First Name" with values Maya, Liam, Ava… (Flash Fill); Room Type moves to D. Objective: Fill cells by using Flash Fill.
  2. On the Calendar worksheet, fill A3:A20 with dates that continue from A2 in steps of one week. Expected result: A3 = 7/12/2027, step 7 days, through A20 = 11/8/2027. Objective: Fill cells by using advanced Fill Series options.
  3. In cell C2 of the Calendar worksheet, enter a formula that returns a column of 10 random whole numbers from 1 to 20. Expected result: C2 =RANDARRAY(10,1,1,20,TRUE). Objective: Generate numeric data by using RANDARRAY().
  4. Format the Rate and Total values on the Bookings worksheet so that they show a thousands separator, no decimal places, and the text " USD" after each number. Expected result: custom format #,##0" USD" on the Rate and Total columns. Objective: Create custom number formats.
  5. Allow only whole numbers from 1 to 14 in the Nights column. Display a stop alert titled Nights with the message Enter 1 to 14 nights. Expected result: validation on the Nights cells: Whole number between 1 and 14; Error Alert style Stop, title "Nights", message "Enter 1 to 14 nights". Objective: Configure data validation.
  6. Apply a rule that fills the entire row of every Suite booking in light green. Apply it to the data rows only. Expected result: conditional formatting on A2:H21 with formula =$D2="Suite" (after task 1, Room Type is column D) and a light green fill. Objective: Create conditional formatting rules that use formulas.
  7. Sort the Bookings data by Room Type and insert subtotals that show the sum of Total for each room type. Expected result: data sorted by Room Type; Subtotal at each change in Room Type, Sum, added to Total; outline with grand total. Objective: Calculate data by inserting subtotals and totals; Group and ungroup data.
  8. On the Guests worksheet, remove records with duplicate email addresses. Expected result: 6 rows removed (Remove Duplicates on the Email column only); 19 records remain. Objective: Remove duplicate records.