CodeVideoNote
中文Workspace

Excel · Original teaching example

Excel: sum one category

This teaching case was authored to show a note format. It was not extracted from a real video or user note, and it has no invented timestamps.

Problem

A column contains categories and another contains amounts. Find the total for one category.

Approach and limits

SUMIF matches the category range to a criterion and adds the corresponding amount cells. Keep the two ranges aligned.

Example code

=SUMIF(A2:A5,"交通",B2:B5)

Check it yourself

If rows 2–5 contain Transport 12, Food 8, Transport 5, Food 4, the Transport total should be 17. Replace the criterion with your own category.