Sum specific word in area

szakharov7723

Board Regular
Joined
Jun 22, 2018
Messages
85
Office Version
  1. 2019
Platform
  1. Windows
Hello,
I have 5 columns, all of them can contain specific word
6th column is numbers.
Is it possible to take all 5 columns, find if cells contain specific word and sum the number if it does.

For example here I want to sum numbers of red only :
[TABLE="width: 500"]
<tbody>[TR]
[TD]red[/TD]
[TD]blue[/TD]
[TD][/TD]
[TD][/TD]
[TD]yellow[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]blue[/TD]
[TD]red[/TD]
[TD]yellow[/TD]
[TD][/TD]
[TD]blue[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]yellow[/TD]
[TD][/TD]
[TD]blue[/TD]
[TD]red[/TD]
[TD][/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]green[/TD]
[TD]green[/TD]
[TD][/TD]
[TD]blue[/TD]
[TD]red[/TD]
[TD]8[/TD]
[/TR]
</tbody>[/TABLE]

the result will be 5+2+4+8 =19

I tried Sumproduct (--(A1:E4="red"),F1:F4) And it didn't work.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
=SUMPRODUCT((A1:E4="red")*(F1:F4))

gives 19

NOTE: ALL occurrences of the colour add the row number,

so Blue gives 21
Row 1, 1 occurrence = 5
Row 2, 2 occurrences = 2 + 2
Row 3, 1 occurrence = 4
Row 4, 1 occurrence = 8
= 5 + 2 + 2 + 4 + 8 = 21
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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