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"

Bokf.datTrans.datTextAmount
2018-05-072018-05-06WILLYS KUNGSGATAN UPPS UPPSALA-2175,49
2018-05-072018-05-06VERO MAT CAFE UPPSALA-296,00
2018-05-072018-05-06CITY GROSS UPPSALA UPPSALA-39,00
2018-05-072018-05-06LINDEX/363 UPPSALA-398,00
2018-05-072018-05-06SKOHUSET UPPSALA-398,00
2018-05-082018-05-08 ensin-1000,00
2018-05-102018-05-09APOTEKET BOLANDERNA UPPSALA-246,40
2018-05-112018-05-11Test2000,00
2018-05-112018-05-10PANDURO HOBBY UPPSALA-299,84
2018-05-112018-05-10BRLeksaker F2273 Uppsala S-123,70
2018-05-112018-05-10KONDITORI FAGELSANGEN GRA UPPS-120,00
2018-05-112018-05-09STORA COOP BOLANDERNA UPPSALA-304,88
2018-05-122018-05-11DJURGARDSBRON SJOCAFE STOCKHOL-80,00
2018-05-122018-05-11NYBRO GRILLEN STOCKHOLM-359,00
2018-05-122018-05-11SKANSEN STOCKHOLM-310,00
2018-05-132018-05-12KD APOTEK UPPSALA-416,50
2018-05-142018-05-13ICA KRYSSET ALMUNGE ALMUNGE-216,68
2018-05-152018-05-14WILLYS KUNGSGATAN UPPS UPPSALA-1191,83
2018-05-152018-05-14QPARK ATOS STOCKHOLM-72,00
2018-05-162018-05-15FJALLNORA FRILUFTSGARD UPPSALA-62,50

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
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,214,428
Messages
6,119,420
Members
448,895
Latest member
omarahmed1

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