Retrieving a value next to a specific cell

New Contributor

I was wondering what formula I need to be able to retrieve all of the values next to specific categories and sum them.

For example, get all of the values next to each food cell in the above range, sum them, and place them under total in the lower table.

Screenshot 2022-01-14 115721.png

2 Replies


Why not use PivotTable?


Actually, as Mr. Baklan said, the best solution is pivot.

But if there is no possibility for pivot, then here is a simple COUNTIFS function for doing your self :).

Example in the file, maybe it helps...if not, please just ignore :).