MSBA-175 · Lesson 2 of 12 · 21 min

Managing and preparing data

▶ Video coming soon A video version of this lesson is on the way.

The second Monday session began with a mess Dagny knew well. Each autumn Maple & Pine exports a year of supplier invoices from its accounting system so she can review vendor spending before the budget. The 2026 export had 1,140 rows, full names in one column, dates as text in another, a few dozen duplicated lines where an invoice had been imported twice, and no totals. Before anything clever could happen, the data had to be prepared. The exam calls this group of skills fill cells based on existing data and format and validate data, and together they sit in the largest domain on MO-211.

Flash Fill

Flash Fill recognizes a pattern from one or two examples and fills the rest of a column. It works on text: splitting, joining, reformatting and extracting. In the export, column B held contact names such as "Holloway, Bryn". Dagny wanted "Bryn Holloway" in column C. She typed the first result in C2, moved to C3 and pressed Ctrl+E (Data > Data Tools > Flash Fill, also Home > Fill > Flash Fill). Excel filled all 1,140 rows.

Flash Fill is fast, but its results are typed values, not formulas. If the source changes, the result does not update, and if the pattern is ambiguous it can guess wrong on a few rows. Two habits help. First, give more than one example when the data varies, such as names with middle initials. Second, check the rows Excel shades or that the Flash Fill Options button offers to select as changed cells. Flash Fill also turns itself on automatically as you type in a column next to data, a behavior controlled by Automatically Flash Fill in File > Options > Advanced.

SourceExample typedFlash Fill result in other rows
Holloway, BrynBryn HollowayReorders every "Last, First" name
INV-2026-04170417Extracts the number after the last dash
northshore floralsNorthshore FloralsProper case
902 555 0147(902) 555-0147Reformats every phone number the same way

Advanced Fill Series options

Everyone knows how to drag the fill handle. The exam objective fill cells by using advanced Fill Series options refers to the Series dialog: Home > Editing > Fill > Series. It gives precise control that dragging does not.

OptionChoicesExample
Series inRows or ColumnsFill down a column or across a row
TypeLinear, Growth, Date, AutoFillLinear adds the step; Growth multiplies by it
Date unitDay, Weekday, Month, YearWeekday skips Saturdays and Sundays
Step valueAny number7 for weekly dates; 1.03 for 3 percent growth
Stop valueAny number or dateStop at December 31, 2027
TrendCheck boxFits a best-fit line or curve to the selected values

For the 2027 budget, Dagny needed a column of month-end dates. She typed January 31, 2027 in A2, selected A2:A13, opened Fill > Series, chose Columns, Date, Month and a step of 1. Excel produced the last day of each month correctly, including February 28. For the venue deposit schedule she needed every weekday in January: Date, Weekday, step 1, stop value January 29, 2027.

Growth is the one people forget. With a start value of 2,400 and a step of 1.04, Growth produces 2,400, 2,496, 2,595.84 and so on: each value is the previous one multiplied by the step. Dagny used it to project a 4 percent yearly rise in florist costs for a five-year planning sheet. Trend with Linear fits a straight line through the values you selected and extends it; with Growth it fits an exponential curve. Both ignore the step value and work from the existing numbers.

Worked problem

Wedding-season Saturdays

Rosalind wants a column listing every Saturday from May 1, 2027 to October 30, 2027 for the wedding calendar. How does Dagny fill it without typing each date?

Show solution
  1. Type May 1, 2027 (a Saturday) in the first cell and select it.
  2. Choose Home > Fill > Series. Series in Columns, Type Date, Date unit Day.
  3. Enter a step value of 7 and a stop value of October 30, 2027.
  4. Click OK and format the column with a date format that shows the weekday.

Answer: A step of 7 days from a Saturday produces every Saturday up to the stop value, 27 dates in all.

Generating test data with RANDARRAY

The exam also lists generate numeric data by using RANDARRAY(). RANDARRAY returns an array of random numbers that spills into neighboring cells; spilling and dynamic arrays are covered fully in lesson 7. Its arguments are all optional: rows, columns, minimum, maximum, and whether to return whole numbers.

Five random decimals between 0 and 1; a 12-by-3 grid of whole numbers from 40 to 220; one row of six decimals.
=RANDARRAY(5)
=RANDARRAY(12, 3, 40, 220, TRUE)
=RANDARRAY(1, 6, 0, 1)

Dagny used the second formula to build a practice sheet of guest counts for twelve months and three event types, so Teo could rehearse PivotTables without touching real client data. Like RAND, RANDARRAY recalculates every time the workbook calculates. To freeze the numbers, copy the range and use Paste Special > Values.

Custom number formats

A number format changes how a value looks without changing the value. The built-in formats cover most needs; custom number formats cover the rest. Open Format Cells (Ctrl+1), choose Number > Custom, and type a format code in the Type box.

A custom format can have up to four sections separated by semicolons: positive numbers; negative numbers; zero; text. If you supply one section it applies to all numbers; two sections cover positives and zeros, then negatives.

A format code broken into four labeled sections separated by semicolons: positive, negative, zero and text. Under each section an example value and its displayed result are shown, such as 1250 displayed as 1,250, negative 300 displayed in red parentheses, zero displayed as a dash, and text followed by a fixed word.
The four sections of a custom number format code.
Code characterMeaningExample code1250.5 displays as
0Digit placeholder; shows zeros0000.001250.50
#Digit placeholder; hides extra zeros#,##01,251
?Digit placeholder; aligns with spaces???.??1250.5
, (after digits)Thousands separator, or scale by 1,000 at the end#,##0.0,1.3
"text"Literal text#,##0 "guests"1,251 guests
[Red], [Blue] …Color for the section#,##0;[Red](#,##0)1,251
[>=1000]Condition for the section[>=1000]#,##0,"K";01K
@Text placeholder@" (client)"text followed by (client)

Dates and times use their own codes: d, dd, ddd and dddd for the day (7, 07, Sun, Sunday), m to mmmm for the month, yy or yyyy for the year, and h, mm and ss for time. Square brackets around a time unit, as in [h]:mm, show elapsed time beyond 24 hours, which Dagny uses for total staff hours at a festival.

Accounting-style negatives with a dash for zero; thousands shown as K; a long date; elapsed hours; a prefix on invoice numbers.
#,##0;[Red](#,##0);"-"
#,##0," K"
dddd, mmmm d, yyyy
[h]:mm
"INV-"0000

The last code solved a real problem. Invoice numbers stored as plain numbers (417) needed to display as INV-0417 without becoming text, so they would still sort and look up correctly. A format changes only the display, so the value stays 417.

Removing duplicate records

The export had invoices imported twice. Data > Data Tools > Remove Duplicates deletes rows whose values match in the columns you choose and keeps the first occurrence. The column choice matters: Dagny ticked Supplier, Invoice number and Amount, because two different invoices from one supplier can share an amount but never an invoice number. Excel reported 37 duplicates removed and 1,103 unique values remaining.

Remove Duplicates deletes data permanently, apart from Undo. Before running it on anything important, work on a copy, or first highlight duplicates with Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values to see what would go. The dynamic array function UNIQUE, covered in lesson 7, gives a non-destructive alternative that returns the distinct rows to a new location.

Fixing text that should be numbers or dates

The export had one more problem that every bookkeeper meets: the invoice dates had arrived as text such as "2026-03-14" stored with a leading apostrophe, and some amounts had a trailing space. Text that looks like a number does not add up, sort or filter as a number. Excel flags many of these cells with a small green triangle; the error button beside the cell offers Convert to Number.

For a whole column, Data > Data Tools > Text to Columns is the fastest repair even when nothing needs splitting. Select the column, choose Delimited, clear every delimiter, and on the third step set the Column data format to Date with the order the text uses (YMD here) or to General for numbers. Excel rewrites every cell as a real value. Text to Columns is also how you split a column on a delimiter such as a comma, and its Advanced button sets the decimal and thousands separators when a file uses the European convention of a comma for decimals.

SymptomLikely causeRepair
Numbers aligned left, SUM returns 0Numbers stored as textConvert to Number, or Text to Columns with General
Dates sort alphabeticallyDates stored as textText to Columns with the Date format and order
Lookups fail on matching valuesTrailing spaces or non-breaking spacesTRIM, or Find and Replace on the space character
Leading zeros disappearCodes treated as numbersFormat as Text before entry, or a custom format such as 00000

Formulas can do the same job when the result must stay live: VALUE converts text to a number, DATEVALUE converts a text date to a serial number, and TRIM removes extra spaces. Dagny prefers the one-off repair for an import she will not refresh, and Power Query, covered in MSBA-171, for anything that arrives every month. After the repair, the 1,103 clean rows summed correctly to the figure in the accounting system, which is the check that tells you preparation is finished.

Grouping and outlining

A long sheet becomes easier to read when related rows or columns collapse. Data > Outline > Group groups the selected rows or columns and adds an outline bar with a minus button to collapse them; Ungroup removes the grouping. Shift+Alt+Right Arrow groups and Shift+Alt+Left Arrow ungroups. Groups can be nested up to eight levels, and the numbered buttons at the top left of the sheet show one outline level at a time.

If a sheet has summary formulas in consistent positions, Data > Group > Auto Outline builds the outline for you. Dagny's budget has monthly columns followed by a quarter total column, so Auto Outline grouped each quarter's three months under its total. Clicking level 1 shows only the yearly total, level 2 shows the quarters, and level 3 shows every month. The Outline dialog launcher sets whether summary rows sit below and summary columns to the right of their details.

Subtotals and totals

The exam objective calculate data by inserting subtotals and totals points at the Subtotal command, which inserts a total row under each group of a sorted list and builds an outline at the same time. It works on ordinary ranges, not on tables; convert a table to a range first (Table Design > Convert to Range).

Worked problem

Spending by supplier category

Dagny wants a subtotal of invoice amounts for each supplier category, and a count of invoices per category, in the cleaned export.

Show solution
  1. Sort the range by Category so each category's rows are together.
  2. Choose Data > Outline > Subtotal. At each change in: Category. Use function: Sum. Add subtotal to: Amount.
  3. Run Subtotal again with function Count on the same field and clear Replace current subtotals.
  4. Use outline level 2 to see one subtotal row per category and the grand total.

Answer: Excel inserts SUBTOTAL formulas under each category and a grand total, with an outline for collapsing the details.

The rows Subtotal inserts use the SUBTOTAL function, whose first argument is a function number: 9 for SUM, 1 for AVERAGE, 2 for COUNT, 3 for COUNTA, 4 for MAX and 5 for MIN. Numbers 101 to 111 do the same but ignore rows you hide manually. SUBTOTAL ignores other SUBTOTAL results inside its range, which is why the grand total does not double count. Remove All in the Subtotal dialog deletes the inserted rows and the outline.

A sum that ignores filtered-out rows; a sum that also ignores manually hidden rows; AGGREGATE summing while ignoring error values.
=SUBTOTAL(9, D2:D48)
=SUBTOTAL(109, D2:D48)
=AGGREGATE(9, 6, D2:D48)

Tables offer a lighter version. Table Design > Total Row adds a row under a table where each cell has a drop-down for Sum, Average, Count, Max and other functions. Those cells also use SUBTOTAL, so they respond to filters. For many everyday totals that is enough; Subtotal is for grouped reports on plain ranges.

Common mistakes

  • MistakeRunning Subtotal on an unsorted list.

    InsteadSort by the grouping column first, or each change in value starts a new group.

  • MistakeExpecting Flash Fill results to update when the source changes.

    InsteadFlash Fill types values; use formulas if the result must stay live.

  • MistakeChoosing every column in Remove Duplicates.

    InsteadChoose the columns that define a true duplicate, such as supplier and invoice number.

  • MistakeMaking invoice numbers text to show a prefix.

    InsteadUse a custom format such as "INV-"0000 so the value stays a number.

  • MistakeTrying to add subtotals to an Excel table.

    InsteadConvert the table to a range first, or use the table Total Row.

Summary and key terms

  • Flash Fill (Ctrl+E) fills text patterns from examples; its results are values, not formulas.
  • Fill > Series sets type (Linear, Growth, Date, AutoFill), date unit, step and stop values.
  • RANDARRAY generates arrays of random numbers; paste as values to freeze them.
  • Custom number formats have up to four sections and change only how values look.
  • Remove Duplicates, Group and Subtotal clean, organize and summarize lists.
Flash Fill
A feature that fills a column by recognizing a pattern from examples.
Growth series
A series in which each value is the previous one multiplied by the step.
Custom number format
A format code that controls how numbers, dates and text display.
Outline
Grouped rows or columns that can be collapsed and expanded by level.
SUBTOTAL
A function that summarizes a range using a function number and ignores other subtotals.
Remove Duplicates
A command that deletes rows whose values match in chosen columns.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. What is the keyboard shortcut for Flash Fill?

    Show answer

    Ctrl+E.

  2. Which Series type multiplies by the step value?

    Show answer

    Growth.

  3. What does the code #,##0;[Red](#,##0);"-" do with a zero?

    Show answer

    Shows a dash.

  4. Which SUBTOTAL function number sums and ignores manually hidden rows?

    Show answer

    109.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz