How to sum values in one column excluding cells with duplicate text values in two different columns?

kakehavata

New Member
Joined
Mar 29, 2021
Messages
24
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows
Hello, forum! I'm new here.

I have the following basic problem. In this table I have three variables:
1617038043441.png


I am using the SUMPRODUCT formula to calculate the sum of all numbers in column C that have a particular index in column A. For example, C13 =SUMPRODUCT(($A1:$A7="A")*(C1:C7))
I would like to exclude all duplicates in terms of all columns, that is C1 and C3, for example, should be counted only once (C13 would then = 7).

What should I add to the formula?

Thank you!
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi,

Your original formula could have been achieved by using just SUMIF, like below:

Excel Formula:
=SUMIF(A1:A7,A13,C1:C7)

For you new requirement, try this:

Book3.xlsx
ABC
1Acarrots3
2Bpotatoes2
3Acarrots3
4Capricots1
5Dpeaches2
6Acarrots2
7Aapples2
8
9
10
11
12
13A7
Sheet879
Cell Formulas
RangeFormula
C13C13=SUMPRODUCT((A1:A7=A13)/(COUNTIFS(B1:B7,B1:B7,C1:C7,C1:C7))*C1:C7)
 
Upvote 0
You could use this, array confirmed with Ctrl Shift Enter.
Excel Formula:
=SUM(IFERROR(C1:C7/COUNTIFS(A1:A7,"A",B1:B7,B1:B7,C1:C7,C1:C7),0))
or with office 365
Excel Formula:
=SUM(INDEX(UNIQUE(FILTER(A1:C7,A1:A7="a",0)),,3))
 
Upvote 0
Hi,

Your original formula could have been achieved by using just SUMIF, like below:

Excel Formula:
=SUMIF(A1:A7,A13,C1:C7)

For you new requirement, try this:

Book3.xlsx
ABC
1Acarrots3
2Bpotatoes2
3Acarrots3
4Capricots1
5Dpeaches2
6Acarrots2
7Aapples2
8
9
10
11
12
13A7
Sheet879
Cell Formulas
RangeFormula
C13C13=SUMPRODUCT((A1:A7=A13)/(COUNTIFS(B1:B7,B1:B7,C1:C7,C1:C7))*C1:C7)

Thank you very much, that solved the problem to a large extent. But what if I want to include cells, which do not contain data (empty cells) like:
1617044663159.png

OR:
1617044748464.png


In some cases I get the #DIV/0 message. Can't they simply not take the empty cells into account?

Thank you!
 
Upvote 0
But what if I want to include cells, which do not contain data (empty cells) like:
Both of my suggestions work with empty cells, although the second one can give false results if there is a quantity with no description.
 
Upvote 0
Both of my suggestions work with empty cells, although the second one can give false results if there is a quantity with no description.
For some reason I am not getting a result with the first formula:
1617045661723.png

(sorry for not using XL2BB, there seems to be a bug)
 
Upvote 0
One more question: what if I want to add other variables using the COUNTIFS function?
So, for example, if we consider columns D and E:
1617051707086.png

The yellow rows would have to count as one.

Thanks!
 
Upvote 0
sorry for not using XL2BB, there seems to be a bug
I assume that you are following all the instructions described here.
What are the symptoms of the bug?
At what point in those instructions does the bug occur?
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,934
Members
449,094
Latest member
teemeren

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