I'm preparing a small data spreadsheet in Google Sheet, where by using pivot table with query I already managed to receive table as follows:
Day 1
Day 3
Day 8
Day 12
Article 1
Volume sold day 1
Volume sold day 3
Volume sold day 8
Volume sold day 12
Article 2
Volume sold day 1
Volume sold da3
Volume sold day 8
Volume sold day 12
Basically we're speaking about the table summing up sales with volumes sold each day (what's important, is that days are random).
I'm trying to sum up the volumes of each day to a whole calendar week so the outcome, I'm thinking of, is:
Week 1
Week 2
Article 1
Volume sold days 1 + 3
Volume sold days 8 + 12
Article 2
Volume sold days 1 + 3
Volume sold days 8 + 12
I'm filtering bigger table using query but this is not that important. To make it short I wrote following code:
=QUERY(<range>;
"select <article_column>,
sum(<volume_column>)
group by <article_column>
pivot <days_column>")
The question is: is there a way to combine week days from separate columns into a whole week and sum up the volumes sold within this particular week? Internet gives me a hint about using ARRAYFORMULA, but since my source database is kind of big, I'm trying to keep all the formulas as simple as it's possible.
Would you be able to recommend good resource to learn more about it? For last 2 hours I keep running in circles over the internet and I cannot find a good idea how to solve it.
Thanks in advance for your hints!
use:
=INDEX(QUERY({"Week "&WEEKNUM(A2:A100)\ B2:C100};
"select Col2,sum(Col3) where Col2 is not null group by Col2 pivot Col1"))
Related
I am trying to create a report from another report(source sheet). :)
The source sheet updates daily automatically by inserting new rows with progress on sales on top of the rows completed a day before:
Date
Product
Units sold
11/15
A
35
11/15
B
12
11/15
C
18
11/14
A
30
11/14
C
11
11/14
B
10
11/13
F
88
11/12
B
7
11/12
A
29
11/12
C
10
11/11
C
8
11/11
A
29
11/11
B
3
The "Units sold" column is cumulative meaning that a newer record on a certain product will show a greater or equal value to a previous record on that specific product.
New products appear in the source sheet when entering the company and they disappear from it when they are sold out, pretty much randomly. (e.g. product "F" that showed up and sold out in the same day)
In the first column in the source report i already found a formula that concatenates date and product and is used by another reports.
To solve this, in the results report i made on column T the same concat of date and product. Then, in my new report, in the results column, i used the following formula: =vlookup(T2,Source!$A2:$C$10000,3,0)-vlookup(T2,Source!$A3:$C$10000,3,0) with the intention to obtain the difference between the amount of products sold in the last day vs the amount of products sold in the day before it, or, better said, the amount of each of the products sold on a specific date. Finally, by using a column of =year() and one of =month() applied on date column and a couple of pivot tables i was able to obtain the value of the daily increment for each and/or year.
The problem i couldn't find a solution for is that when the source sheet updates, the new rows added with the freshest data move down the cell references from the vlookup formula i used in the results sheet.
Please help me find a way to "pin down" the cell references in the vlookup formula without being affected by the new rows insertions.
Thank you!
to "pin down" the references you can use INDIRECT
example:
A1:A >>> INDIRECT("A1:A")
I have 1 column of dates and 1 column of 'wins' recording 1 and -1 as wins and losses. I need a quick way to tally the score across each date (so I can graph the win-rates). Eg. 5th May 7 wins, 6th may -2 wins, etc. I have multiple entries for each date and several days to work through so I can't do it manually. What would be the simplest approach/formula to solve this issue?
I'm working in Google Sheets. If someone has a simple workaround in Excel too, the solution is welcome.
Try:
=SUMPRODUCT(($A$2:$A$12=$E$1)*($B$2:$B$12)) in cell E6
Data structure:
=QUERY(A1:B, "select A,sum(B)
where A is not null
group by A
label sum(B)''")
I have a simple table with Monthly downloads data for the last 24 months. I want to build a simple Summary showing the following columns.
Number of Downloads for last Month
Downloads in the last 3 Months
Downloads in the last 6 Months.
Downloads in Last 6 Months (last year)
Downloads in Last 3 Months (last year)
Downloads in Last Month (last year)
I tried to group the data in the pivot table - but I can't seem to get it to work as Google Sheets doesn't allow overlapping Groups.
I tried using Calc fields - but again it doesn't seem to allow me to break it out by months.
Any Idea - how to do this or am I asking too much of Google Sheets?
Added a dummy set of data: https://docs.google.com/spreadsheets/d/1qhuXf__hvJMZjXcugBZyiq_lZBqFNTTkCHEvh9rcUK0/edit?usp=sharing
={QUERY(TRANSPOSE(QUERY(TRANSPOSE({$C$3:$O$5,$C$7:$O$9}),
"select Col2,Col3
where Col1>=date'"&TEXT(DATE(E13,1,1),"yyyy-mm-dd")&"'
and Col1< date'"&TEXT(DATE(E13,9,1),"yyyy-mm-dd")&"'")),
"select Col2+Col3+Col4+Col5+Col6+Col7+Col8+Col9
label Col2+Col3+Col4+Col5+Col6+Col7+Col8+Col9''"),
QUERY(TRANSPOSE(QUERY(TRANSPOSE({$C$3:$O$5,$C$7:$O$9}),
"select Col2,Col3
where Col1>=date'"&TEXT(DATE(E13,9,1),"yyyy-mm-dd")&"'
and Col1< date'"&TEXT(DATE(E13+1,1,1),"yyyy-mm-dd")&"'")),
"select Col2+Col3+Col4+Col5
label Col2+Col3+Col4+Col5''"),
QUERY(TRANSPOSE(QUERY(TRANSPOSE({$C$3:$O$5,$C$7:$O$9}),
"select Col2,Col3
where Col1>=date'"&TEXT(DATE(E13,12,1),"yyyy-mm-dd")&"'
and Col1< date'"&TEXT(DATE(E13+1,1,1),"yyyy-mm-dd")&"'")),
"select Col2")}
demo spreadsheet
I have a production schedule where cells are filled with text:
Day 1, Day 2 etc.
And I'd like these cells to be associated with values elsewhere in the same sheet.
For example. Day 1 would be 4 (which corresponds to 4 hours).
Then I have to sum these cells/values (Day 1 = 4 + Day 2 = 6) to get a total for each row.
I can't seem to find a way to do all this using one formula. Is it even possible?
Feel free to check out the sheet.
=SUMPRODUCT(IFERROR(VLOOKUP(B2:L2,Formulas!A:B,2,0)))
So basically I need a dynamic select statement which changes references when dragged across rows or columns.
Example of what I need.
=sum(query('Sheet1'!$A$1:$F$621, Indirect("Select"&$F&"Where A='ABC' AND B="&"Sheet2!"&$A1)))/20
Sample Sheet 1 (Data Sheet)..--Since I am not allowed to use images till i reach rep 10 lol :)
Column 1 - Sales Sites (ABC, DEF, GHI.....)
Column 2 - Sales Roles (SM, ASM, SE.....)
Column 3 - Sales in Month Jan
Column 4 - Sales in Month Feb
Column 5 - Sales in Month Mar
Sample Sheet 2 (Desired Output)
Description (in pivot terms):
Site wise (filter)
Role wise (Rows)
Month wise (Columns - Sum of Jan, Feb etc)
Value (Sum of Jan/20)--To get day wise sales numbers
FYI:
I have tried using pivots, but google spreadsheets don't allow use of calculated fields in pivots in any manner (for the /20 in the formula), hence trying to achieve the same results by formula.
I know a table on the basis of the pivot table could help solve this problem, but to make it more efficient I am trying to avoid using 2 tables.
Many Thanks for your help in advance, please let me know if you need additional info to understand the scenario.