Multiple Column Duplicates : Sum - excel

I have data like:
A1 B1 C1 v1
A1 B1 C1 v2
A1 B1 C2 v3
A1 B2 C1 v4
A2 B3 C2 v5 ....
I would like to sum all duplicate tuple (A, B, C) but only if all three values are same, that is Ai = Aj, Bi = Bj and Ci = Cj
I would like the result to be in format:
A1 B1 C1 [sum of relevant vs]
...
I know about SUMIF and Pivot function, but so far couldn't get them to work as required.
Any help will be appreciated.
PS: Previous search on stackoverflow reveals solutions for duplication across single column only. If I miss anything in my search, I am sorry and would appreciate the link to relevant thread.

A pivot table is the most appropriate solution to me. Put all three columns A, B and C under row labels and put the 4th column under Values. It should automatically sum the values in the 4th column:
After that, pick Tabular and Repeat items and then Do Not Show Subtotals under PivotTable Design:
And you will get this:

Related

return a list of all elements present in one column that is not present in the other

I'm trying to create column where there are hundreds of items in a and b column, and I want to remove common items in b column and list them in different column in excel or google sheet.
a
b
items present in b column only
a1
a1
a5
a2
a2
a6
a3
a5
a4
a6
Excel:
Formula in C2:
=FILTER(B2:B5,COUNTIF(B2:B5,A2:A5)=0)
Google-Sheets:
Almost the same, but less explicit: =FILTER(B2:B,COUNTIF(B2:B,A2:A)=0)

Count rows in an excel table where columns satisfy multiple criteria (simulating multi-filter criteria)

I am wondering if there is a simple way to count the number of rows after filtering a subset of columns by value considering multiple selections for a given column in an excel table object.
Let's say I have the following excel table:
A B C
a1 b1 c1
a2 b2 c1
a1 b2 c2
a2 b1 c2
a1 b3 c3
a3 b1 c3
saved in an excel table under the name: Table1 and I would like to find all rows that the column A has the value a1 or a2 and column B has the value: b1. The result should be 2.
I am able to do it using SUMPRODUCT function and converting the logical value into [0,1] using the -- operator:
= SUMPRODUCT(--(Table1[A]="a1"),--(Table1[B]="b1"))
+ SUMPRODUCT(--(Table1[A]="a2"),--(Table1[B]="b1"))
In my real example, I have more than three columns and at least one of them can satisfy multiple criteria so I am wondering if there is a way to do it with a less verbose syntax. For example, I was trying something like this, but it does not work:
= SUMPRODUCT(--(Table1[A]="a1|ab2"),--(Table1[B]="b1"))
or
=SUMPRODUCT(--(Table1[A]=OR("a1", "a2")), --(Table1[B]="b1"))
the OR function does not help, because it does not return an array result, and I cannot use the array formula in my real example because I would need to apply just for one column with more than one selection, but for the rest of the columns I am selecting it is just a single value.
It seems to be a good trick for representing in an excel formula a multiple filter criteria action, but the excel formula is very verbose when within a column it has to satisfy more than one condition, like in the above example.
Under my solution, it would something like this for counting rows in a Table where for each column we filter by only one value except for the first column A that we filter by two possible values:
= SUMPRODUCT(--(Table1[A]="a1"),--(Table1[B]="b1"),
--(Table1[C]="c1"), ...Table1[Z]="z1"))
+ SUMPRODUCT(--(Table1[A]="a2"),--(Table1[B]="b1"),
--(Table1[C]="c1"), ...Table1[Z]="z1"))
Try:
=SUMPRODUCT((Table1[A]="a1")+(Table1[A]="a2"),--(Table1[B]="b1"))
Since any given cell's cannot both be "a1" and "a2", the sum will be 1 if either is true and 0 if neither is true

Spark Join Returning Null Values in Columns

I'm pulling my hair out trying to solve what I feel is an extremely simple problem, but I'm not sure if there's some spark voodoo occurring as well.
I have two tables, which are both very small. Table A has about 90K rows and Table B has about 2K rows.
Table A
A B C D
===========
a1 b1 c1 d1
a1 b1 c2 d2
a1 b1 c3 d3
a2 b2 c1 d1
a2 b2 c2 d2
.
.
.
Table B
A B E F
===========
a1 b1 e1 f1
a2 b2 e2 f2
I want a table that looks like
Result Table
A B C D E F
=================
a1 b1 c1 d1 e1 f1
a1 b1 c2 d2 e1 f1
a2 b2 c1 d1 e2 f2
.
.
.
I was a little loose, but the idea is I want to join the table with fewer rows on the table with more rows and it's okay to have multiple associated values in the final table.
This should be really simple:
table_a.join(table_b, table_a.a == table_b.a, table_a.b == table_b.b).select(..stuff..)
HOWEVER, for almost all of the resulting values in the Result Table (which should have about 90K rows since Table A has about 90K rows), I get null values in columns E and F.
When I save the result of just Table B, I see all the columns and values.
When I save the result of just Table A, I see all the columns and values.
(i.e I could do a paper and pencil join)
The weird thing is that even though ~89K rows have null values in columns E and F in the Result Table, there are a few values that do randomly join.
Does anyone know what's going on or how I can diagnose this?
Have you tried <=> instead of == in your join?

Excel: Cell contents as formula requirements

I have a simple formula =sum(sum(d5*u300)/g4)
Is it possible to have the formula look up cell A1 for the d, a2 for the 5, a3 for the u, A4 for the 300, A5 for the the g and a6 for the 4. In other word each formula cell reference is made up of the contents of two other cells.This would be used in a selection process to produce a table for a graph. NON Excel Users could then use a drop down list in A1 to select column d etc. With thanks.
Do you mean something like:
=SUM(SUM(INDIRECT(A1&A2)*INDIRECT(A3&A4))/INDIRECT(A5&A6))
? Let's say A1 contains D and A2 contains 5. Then INDIRECT(A1&A2) will return the value of the cell D5.
However, I don't understand why you use SUM with just one argument.

Get all combinations of the first column's value and other column's value

I have an irregular table in Excel:
A A1 A2 A3
B B1
C C1 C2 C3 C4
...
How can I get the following its representation?
A A1
A A2
A A3
B B1
C C1
C C2
C C3
C C4
...
This answer in SuperUser to Transform horizontal table layout to vertical table using VBA appears to give exactly what you are looking for.
The code is self explanatory by virtue of working step by step.
Hope it helps.

Resources