Sum different unknown values from multiple tables in Google Spreadsheet - google-sheets

I'm having the following Issue and don't get the right formula. I don't even know, if it is possible.
I'm having three tables with different values. I want to calculate and sum up, which value appears how many times in all three tables. I don't really know the value when starting the process, so it should count the following: How often are which values shown in the tables.
Find a example of the problem here
so, the result should tell me, that overall, there are 3 values (a,b,c) and each value has a total quantity of 60.
Here, you'll find the result I'm looking for
I want to do that calculation with google spreadsheet, but I really don't get any solution.
Can somebody help? Thank you already in advance.

Try to use query function:
=QUERY({'Sheet1'!A1:B;'Sheet2'!A2:B;'Sheet3'!A2:B},"select Col2, sum(Col1) group by Col2")

Related

Unpivoting using QUERY function is not fetching the expected result

I am currently working on a dataset that includes several columns, mostly the dates. What I am trying to achieve is - unpivot all the date columns to use for my subsequent calculations. I use the following formula to unpivot: =ARRAYFORMULA(SPLIT(FLATTEN(Data!A2:A&"|"&Data!D1:AG1&"|"&Data!D2:AG),"|"))
Even though this returns the expected result, when I try to nest this within a Query function, it does not work correctly. This is how I applied the formula - QUERY(ARRAYFORMULA(SPLIT(FLATTEN(Data!A2:A&"|"&Data!D1:AG1&"|"&Data!D2:AG),"|")),"Select * WHERE Col3 IS NOT NULL")
PS: When I change the data range to say, A2:A100, it gives me the correct result. However, it does not help since lot of new data would get added and I want the formula to be dynamic.
Here's the link to the sample sheet - https://docs.google.com/spreadsheets/d/1dgFY5mT9nUJtFefjAros-XpWXRMFtxEf8Fqrv82N5Ys/edit#gid=1813140523
Any help/suggestions would be highly appreciated
Not sure where you got your SPLIT(FLATTEN technique,
but you have to include both the 3rd and 4th parameters of the split function as FALSE or 0. so in your case it would be:
=ARRAYFORMULA(SPLIT(FLATTEN(Data!A2:A&"|"&Data!D1:AG1&"|"&Data!D2:AG),"|",0,0))
If you do that you'll find your query works.
Also note that the way you have it it's not really working. If you look all the way down in column 1 you'll find a bunch of dates formatted to look like integers.

How to summarize values when column values are identical?

I am pretty much using Tableau as a pivot table here. How can I summarize the order volume column so that, because all of the previous column values are the same, it will read as 3 instead of 1 and 2? Sum() hasn't worked for me.
Thank you!!!
Screenshot
Based on what you provided as sample, you may want to calculate the max value for that specific column, in order to have just one "aggregated value".
Using the superstore dataset you can replicate this, trying to calculate the max Order ID for a specific customer regardless the number of rows:
{ FIXED [Customer Name] : max ([Order ID])}
The result could look like this:

Is there a google sheets function to count with using arrays of sums as criteria?

I have been struggling for a few days with this problem. Anyone kind enough to show some interested will be highly appreciated.
I have the table shown below.
Suppose columns represent months. I would like to know up to which months' orders have been used up.
I have tried criteria with sums of demand up to that point but I cannot seem to use criteria with the sum of total demand and an array of sums of "total units ordered".
F.e. =COUNTIF(SUM($S$2:($S$2:S$2))<SUM($S$1:S$1) is not possible.
I have tried using an index-match combo but i would have to deduct the previous max sum of "total units ordered" that meets the condition up to the previous cell.
Is that possible without using vba?
Thanks in advance for your interest and time spent.
You can use a standard method of getting running totals using Sumif, combined with Match:
=ArrayFormula(match(sumif(column(S1:Z1),"<="&column(S1:Z1),S1:Z1),sumif(column(S2:Z2),"<"&column(S2:Z2),S2:Z2))-1)
I put rows 3 and 4 in just as a check of my calculations and to show the results of the two Sumifs evaluations - they aren't necessary.
You may wish to specify what should happen if the demands add up to exactly 3000, for example. The above formula would actually go to the next month, so may need some refinement if that is not what you want.

How to use AVERAGEIFS within ARRAYFORMULA

I am trying to use AVERAGEIFS inside ARRAYFORMULA. Looking at other questions, I have come to the conclusion that it is not possible without using QUERY function.
My intention is to average the values of a column whenever they share the same ID.
I think this question comes pretty close to what I need, but I haven't been able to replicate and adapt its solution on my own sheet.
In this sheet I show the result I expect (I got it by dragging the formula). I've also reviewed the Query Language Reference, unsuccessfully.
Thanks a lot for your time and effort.
So the formula should be
=ArrayFormula(iferror(sumif(A2:A,A2:A,B2:B)/countif(A2:A,A2:A)))
Note that if there were any text values in the points column, this would still return a result (because count would be greater than zero) - you could instead use
=ArrayFormula(if(isnumber(B2:B),(sumif(A2:A,A2:A,B2:B)/countif(A2:A,A2:A)),""))
If you had a mixture of rows with text and rows with numbers for any ID, this would return a smaller result than the avg or average formula. This is a limitation of this method. You can't put an extra condition in (that column B has to contain a number) because you would need countifs and countifs isn't array-friendly. It still seems strange that AFAIK countif and sumif are the only functions out of this family that are array-friendly while countifs, sumifs, averageif etc. are not.
you can do:
=ARRAYFORMULA(IFERROR(VLOOKUP(A2:A; QUERY(A2:B; "select A,avg(B) group by A"); 2; )))

Google Spreadsheet: SUMIFS for same Column

I've got a problem in Google Spreadsheets:
I don't know why, but for Google there is a problem to use the SUMIFS formula.
When I try to use the SUMIFS formula for different criteria, for the same column, the output is always zero 0.
I tried aleady other things, but anyways it doesn't work.
Here are my examples:
Example 1
=SUMMIFS('Sheet1'!G1:G100;'Sheet1'!C1:C100;"Criteria1";'Sheet1!C1:C100;"Criteria2";'Sheet1'!D1:D100;"Criteria3")
Example 2
=SUMMIFS('Sheet1'!G1:G100;'Sheet1'!C1:C100;{"Criteria1" ;"Criteria2"};'Sheet1'!D1:D100;"Criteria3")
Example 3
=SUMMIFS('Sheet1'!G1:G100;'Sheet1'!C1:C100;"*Criteria1"&"Criteria2";Sheet1'!D1:D100;"Criteria3")
Non of these work. I dont know what I should do. Anyone has an idea?
Thanks in Advance
This behavior is probably correct. SUMIF criteria are connected AND not OR. This means all criteria need to be true.
So if you have two criteria on the same column it is very likely that only one of them can be true at the same time. Eg. column C can not be "Car" and "Book" at the same time. Therefore it is never count into the sum and always results 0.
To OR connect criteria have a look here: SUMIFS with OR.
this formula works:
=SUM(ARRAYFORMULA(SUMIF('Sheet1'!G1:G100;'Sheet1'!C1:C100 & 'Sheet1'!C1:C100 ;{"Criteria1";"Criteria2"} ; 'Sheet1'!D1:D100;"Criteria3")))
Anyways the bad thing is, that this formula cant disting date criterias.
Example1:
=SUMIFS(G2:G100;D2:D100;">=01.06.2011";F2:F100;"<=30.07.2011")
Does work, but this example 2 doesnt work:
Example 2:
=SUM(ARRAYFORMULA(SUMIF(D2:D100 & F2:F100;">=01.06.2011"&"<=30.07.2011";G2:G100)))
I Dont know why it doesnt work, has anybody a solution for this ?
Thanks in advance.

Resources