[Solved] Sum if adjacent contains...

Discuss the spreadsheet application

[Solved] Sum if adjacent contains...

Postby illern » Tue Feb 19, 2019 5:15 pm

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
illern
 
Posts: 11
Joined: Wed Jul 12, 2017 4:57 pm

Re: Sum if adjacent contains...

Postby FJCC » Tue Feb 19, 2019 5:24 pm

SUMIF() will do the job with a formula like
Code: Select all   Expand viewCollapse view
=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 12 times
Windows 10 and Linux Mint, since 2017
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
FJCC
Moderator
 
Posts: 7133
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Sum if adjacent contains...

Postby illern » Tue Feb 19, 2019 5:48 pm

I love this forum!
Tremendous. Thank you!
Open Office 4 running on Mac OS Sierra 10
illern
 
Posts: 11
Joined: Wed Jul 12, 2017 4:57 pm

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

Postby robleyd » Wed Feb 20, 2019 12:08 am

Another approach would be a Pivot Table formerly known as Data Pilot.
Cheers
David
Apache OpenOffice Developer Build 4.2.0 9820 - Slackware 14.2 - 64 bit
LibreOffice 6.0.7.3 - Slackware 14.2 - 64 bit
Apache OpenOffice 4.1.4 - Windows 7 Virtual machine
User avatar
robleyd
Moderator
 
Posts: 2643
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia


Return to Calc

Who is online

Users browsing this forum: No registered users and 10 guests