In a google spreadsheet I have 2 column pairs, EAN + number in stock
Some EAN's are present in both column A and C, some only in column A column and some only in column B.
Eaxmple:
A B C D E F
8573489753888 1 8729029847359 2
8789026119040 1 8434234872389 1
8789026118692 3 8789026118609 2
8729029847359 1 8789026118692 1
I need to find EAN's present in both column A and C and calculate the stock difference (column B and D). The result should be listed in column E and F.
I created a script that does this, but since I keep hitting the max execution time (the list is getting long), I am hoping this could be done without a script as well.
The results should be as follows:
A B C D E F
8573489753888 1 8729029847359 2 8789026118692 2
8789026119040 1 8434234872389 1 8729029847359 -1
8789026118692 3 8789026118609 2
8729029847359 1 8789026118692 1
full diference:
=ARRAYFORMULA(QUERY({A1:B; C1:C, D1:D*-1},
"select Col1,sum(Col2)
where Col1 is not null
group by Col1
label sum(Col2)''", 0))
reverse:
relevant diference:
=ARRAYFORMULA(QUERY({A1:B, IFERROR(VLOOKUP(A1:A, C1:D, 2, 0))},
"select Col1,Col2-Col3
where Col3 is not null
label Col2-Col3''", 0))
reverse:
Nice solution. I tried just with vlookup and it gets really complicated: =IF(ISNA(VLOOKUP(E1;A:B;2;FALSE()));IF(ISNA(VLOOKUP(E1;C:D;2;FALSE()));0;VLOOKUP(E1;C:D;2;FALSE()));VLOOKUP(E1;A:B;2;FALSE())-IF(ISNA(VLOOKUP(E1;C:D;2;FALSE()));0;VLOOKUP(E1;C:D;2;FALSE()))
Related
a
b
c
d
e
f
result
1
q
4
r
q
2
w
5
t
w
3
e
6
e
r
7
r
8
r
t
Column ranges must be used from row 3 to the entire row.
The range referring to the image is B3:B column, D3:D column. Please ignore columns A and C.
The result must not contain blank cells.
Try:
=QUERY(FLATTEN(TRANSPOSE(FILTER(A3:D,MOD(COLUMN(A3:D),2)=0))),"where Col1 is not null")
Col A
Col B
Col C
a
back
1
a
back
1
b
b
draw
1
c
back
1
c
d
draw
1
d
draw
1
e
draw
1
In Column E I put the values from Column A using UNIQUE and sorting with SORT:
=SORT(UNIQUE(A:A))
In Column F I tried to put a single formula in the first row, to sum each of the total values in Col C according to some filters:
=ARRAYFORMULA(IF(E1:E="","",SUMIF(
FILTER(A1:A,(B1:B<>"draw")*(C1:C<>"")),
E1:E,
FILTER(C1:C,(B1:B<>"draw")*(C1:C<>""))
)))
But I get the error:
Argument must be a range.
Expected Result:
Col E
Col F
a
2
c
1
Is there a way to make the filters become ranges or how should I proceed to avoid this error?
try:
=QUERY(A1:C, "select A,sum(C) where not B matches 'draw|^$' group by A label sum(C)''")
I have data like below:
1 2 3 A B C
4 5 6 A B C
7 C
3 4 B C
8 9 C B
1 2 3 C A B
The values 1-9 are assigned to values A, B, C - so for instance in first row A=1, B=2, C=3 etc.
I need to summarize all the elements above to get A, B, C.
How to start with this problem?
Final results:
A 7
B 22
C 29
Edit:
https://docs.google.com/spreadsheets/d/1kzOtV9_SE5s7DaA_6YcZq6z08FpfXaIAjukyISew49U/edit?usp=sharing
This should do your summary provided the ranges are the same dimensions.
=QUERY({FLATTEN(Arkusz1!F2:H)\FLATTEN(Arkusz1!B2:D)};"select Col1,SUM(Col2) where Col1<>'' group by Col1 order by SUM(Col2) desc label Col1'Summary'")
It is installed in a new tab called MK_Help
I have a Google sheets with the following layout
Key Points Category Done
1 4 A Yes
2 4 B
3 1 B
4 5 C Yes
5 7 D Yes
6 4 B
7 2 C Yes
I need a formula that can sum the points based on category if the Done is "yes". So the output should be
Points done Category
7 C
4 A
7 D
Whch formula can I use for this? (I don't want to use pivot table)
try:
=QUERY({A2:D}; "select sum(Col2),Col3 where Col4 = 'Yes' group by Col3 label sum(Col2)''")
I have 4 columns with values (A and C are products that mostly overlap, B and D are counts. What I'd like to do is for the values that occur in both A and C calculate the difference between B and D, and put the result in E and F.
So for example 5028421938592 count is 6 in column B and count is 2 in column D.
The result would be then be in column E: 5028421938592 and column F: 4
5028421928548 3 5028421928548 1
5028421938592 6 3259190205192 7
5028421997131 1 5028421938592 2
5028421995748 4 5028421995748 1
I suggest in E1:
=unique(query({A:B;C:D},"select Col1 where Col1 is not null order by Col1"))
and in F1 and copied down to suit:
=iferror(vlookup(E1,A:B,2,0),0)-iferror(vlookup(E1,C:D,2,0),0)