[Solved] Sum if adjacent contains...

Discuss the spreadsheet application
Post Reply
illern
Posts: 11
Joined: Wed Jul 12, 2017 4:57 pm

[Solved] Sum if adjacent contains...

Post by illern »

Hi
I'd like to know if it's possible to sum a number (cost) if the adjacent cell contains a specific word.
Example:
On one tab I'd like to make a list of costs, like this:

Cost Item Category
10 Banana Fruit
23 Carrot Vegetable
5 Apple Fruit

One the next tab, I'd like to automatically search the list and sum the costs, in order to see how much I've currently spent on fruit, for example. So that I end up with a new list:

Category Total spent
Fruit 15
Vegetable 23

How do I do it?
Thanks
Last edited by illern on Tue Feb 19, 2019 5:49 pm, edited 1 time in total.
Open Office 4 running on Mac OS Sierra 10
FJCC
Moderator
Posts: 9277
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Sum if adjacent contains...

Post by FJCC »

SUMIF() will do the job with a formula like

Code: Select all

=SUMIF(Sheet1.C2:C4;A2;Sheet1.A2:A4)
Please see the attached document. To formula is on Sheet2.
Attachments
SummingFood.ods
(9.35 KiB) Downloaded 113 times
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
illern
Posts: 11
Joined: Wed Jul 12, 2017 4:57 pm

Re: Sum if adjacent contains...

Post by illern »

I love this forum!
Tremendous. Thank you!
Open Office 4 running on Mac OS Sierra 10
User avatar
robleyd
Moderator
Posts: 5086
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: [Solved] Sum if adjacent contains...

Post by robleyd »

Another approach would be a Pivot Table formerly known as Data Pilot.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
Post Reply