Sum values based on certain criteria

willwall

New Member
Joined
Sep 22, 2016
Messages
44
Office Version
  1. 365
Platform
  1. Windows
Hello
I am trying to get the sum of cells containing certain text. For example, I would like to get the sum of the cells that contain the following text "WILLYS", "GROSS", "SKANSEN"

[TABLE="width: 646"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Bokf.dat[/TD]
[TD]Trans.dat[/TD]
[TD]Text[/TD]
[TD]Amount[/TD]
[/TR]
[TR]
[TD]2018-05-07[/TD]
[TD]2018-05-06[/TD]
[TD]WILLYS KUNGSGATAN UPPS UPPSALA[/TD]
[TD="align: right"]-2175,49[/TD]
[/TR]
[TR]
[TD]2018-05-07[/TD]
[TD]2018-05-06[/TD]
[TD]VERO MAT CAFE UPPSALA[/TD]
[TD="align: right"]-296,00[/TD]
[/TR]
[TR]
[TD]2018-05-07[/TD]
[TD]2018-05-06[/TD]
[TD]CITY GROSS UPPSALA UPPSALA[/TD]
[TD="align: right"]-39,00[/TD]
[/TR]
[TR]
[TD]2018-05-07[/TD]
[TD]2018-05-06[/TD]
[TD]LINDEX/363 UPPSALA[/TD]
[TD="align: right"]-398,00[/TD]
[/TR]
[TR]
[TD]2018-05-07[/TD]
[TD]2018-05-06[/TD]
[TD]SKOHUSET UPPSALA[/TD]
[TD="align: right"]-398,00[/TD]
[/TR]
[TR]
[TD]2018-05-08[/TD]
[TD]2018-05-08[/TD]
[TD] ensin[/TD]
[TD="align: right"]-1000,00[/TD]
[/TR]
[TR]
[TD]2018-05-10[/TD]
[TD]2018-05-09[/TD]
[TD]APOTEKET BOLANDERNA UPPSALA[/TD]
[TD="align: right"]-246,40[/TD]
[/TR]
[TR]
[TD]2018-05-11[/TD]
[TD]2018-05-11[/TD]
[TD]Test[/TD]
[TD="align: right"]2000,00[/TD]
[/TR]
[TR]
[TD]2018-05-11[/TD]
[TD]2018-05-10[/TD]
[TD]PANDURO HOBBY UPPSALA[/TD]
[TD="align: right"]-299,84[/TD]
[/TR]
[TR]
[TD]2018-05-11[/TD]
[TD]2018-05-10[/TD]
[TD]BRLeksaker F2273 Uppsala S[/TD]
[TD="align: right"]-123,70[/TD]
[/TR]
[TR]
[TD]2018-05-11[/TD]
[TD]2018-05-10[/TD]
[TD]KONDITORI FAGELSANGEN GRA UPPS[/TD]
[TD="align: right"]-120,00[/TD]
[/TR]
[TR]
[TD]2018-05-11[/TD]
[TD]2018-05-09[/TD]
[TD]STORA COOP BOLANDERNA UPPSALA[/TD]
[TD="align: right"]-304,88[/TD]
[/TR]
[TR]
[TD]2018-05-12[/TD]
[TD]2018-05-11[/TD]
[TD]DJURGARDSBRON SJOCAFE STOCKHOL[/TD]
[TD="align: right"]-80,00[/TD]
[/TR]
[TR]
[TD]2018-05-12[/TD]
[TD]2018-05-11[/TD]
[TD]NYBRO GRILLEN STOCKHOLM[/TD]
[TD="align: right"]-359,00[/TD]
[/TR]
[TR]
[TD]2018-05-12[/TD]
[TD]2018-05-11[/TD]
[TD]SKANSEN STOCKHOLM[/TD]
[TD="align: right"]-310,00[/TD]
[/TR]
[TR]
[TD]2018-05-13[/TD]
[TD]2018-05-12[/TD]
[TD]KD APOTEK UPPSALA[/TD]
[TD="align: right"]-416,50[/TD]
[/TR]
[TR]
[TD]2018-05-14[/TD]
[TD]2018-05-13[/TD]
[TD]ICA KRYSSET ALMUNGE ALMUNGE[/TD]
[TD="align: right"]-216,68[/TD]
[/TR]
[TR]
[TD]2018-05-15[/TD]
[TD]2018-05-14[/TD]
[TD]WILLYS KUNGSGATAN UPPS UPPSALA[/TD]
[TD="align: right"]-1191,83[/TD]
[/TR]
[TR]
[TD]2018-05-15[/TD]
[TD]2018-05-14[/TD]
[TD]QPARK ATOS STOCKHOLM[/TD]
[TD="align: right"]-72,00[/TD]
[/TR]
[TR]
[TD]2018-05-16[/TD]
[TD]2018-05-15[/TD]
[TD]FJALLNORA FRILUFTSGARD UPPSALA[/TD]
[TD="align: right"]-62,50[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
You could use SUMIF with a wild card:

=SUMIF($C$2:$C$21,"*WILLYS*",$D$2:$D$21)

Assuming C2:C21 contains the text and D2:D21 is the amount.

This returns -3367.32 in this example.

EDIT: If you want it more dynamic then make some helper cells with the words "WILLYS", "GROSS" & "SKANSEN" in and reference them instead.

I.e. if cell G2 is "SKANSEN" then:
=SUMIF($C$2:$C$21,"*"&G2&"*",$D$2:$D$21)
 
Last edited:
Upvote 0
Hello again
Just one more question. This formula returns for example "skansen". =SUMIF($C$2:$C$21,"*"&G2&"*",$D$2:$D$21) (Skansen is in cell G2)
How do i write the formula to return "Gross" and skansen together, lets say "Gross" is in cell G3?
 
Upvote 0
I'd probably just do an addition in that case:

=SUMIF($C$2:$C$21,"*"&G2&"*",$D$2:$D$21)+SUMIF($C$2:$C$21,"*"&G3&"*",$D$2:$D$21)
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top