Classify a ledger line by keyword (SEARCH)

Medium Logic Accounting pack
Description
Hints 0/4
Solutions 0
–
Test case
1
Reset
Submit
fx
A
B
C
D
E
F
G
1
2
3
4
5
6
7
8
9
10
Loading interactive spreadsheet...
Preparing grid cells and formula calculation engine
○ Ready Enter formula in highlighted cells, then click Submit.

The problem

Problem statement

The description to classify is in A2. Put "Travel" when it mentions fuel, "Rent" when it mentions rent, and "Other" otherwise, in the Account cell B2.

Match anywhere in the text, not just at the start, and ignore case.

Problem data

Show the sheet as a table (selectable, copyable)
The exercise data, as a table
AB
1DescriptionAccount
2Diesel fuel for the van
3Office rent, February
4Printer paper

Notes

SEARCH finds a substring and ignores case; on a miss it raises an error, so ISNUMBER turns it into TRUE/FALSE. Testing from the most specific keyword to the least avoids classifying "rental car" as Rent when it should be Travel.

How to approach

Your answer goes in B2.

  1. Target cell is B2
  2. SEARCH returns a position or an error
  3. ISNUMBER makes that a TRUE/FALSE
  4. Shape: =IF(ISNUMBER(SEARCH(?, ?)), ?, ?)

Function guide

Related practice

FAQ

How do I classify text by keyword?

=IF(ISNUMBER(SEARCH("keyword", cell)), "Category", "Other"), nested for more keywords. SEARCH ignores case; FIND does not.

Why does my classification miss some lines?

The keyword does not appear exactly as typed — a different word, a typo, or a trailing space. Review the unmatched lines and extend the keyword list.