I have a sheet that I am using to track wordcount over multiple writing projects. I'd like to have it automatically add up the words I've written that day. I write in multiple sessions, and each session is its own row on the sheet.
I continue to add onto the sheet during the month, so using DATE won't work unless I want to manually change the formula every time a new day starts. I'd really appreciate whatever help could be given.
Here is the link to the sheet--this one is a copy, so feel free to poke around as needed and don't worry about messing it up :) https://docs.google.com/spreadsheets/d/1mNrJzSDpfTRuvZSRpt7BQn0HfA2mdhZzTym2DqNlXZU/edit?usp=sharing
delete all in column I and use in row 1:
={"Daily Total"; INDEX(IFNA(VLOOKUP(IF(COUNTIFS(A2:A, A2:A,
ROW(A2:A), "<="&ROW(A2:A))=1, A2:A, ), QUERY({A2:A, H2:H},
"select Col1,sum(Col2) where Col2 is not null group by Col1"), 2, 0)))}
Related
Is there a way to get the result column in the picture below?
All i want to do is text join the Col1 if the corresponding Col2 belongs to the same groups (E.G. 1,2,3....).
Reminded that I want to use arrayformula instead of dragging down the "normal" formula myself everytime.
Use this formula
Or Make a copy of this example sheet.
=ArrayFormula({"Result";
IF(A2:A="",,
BYROW(B2:B,
LAMBDA(v,JOIN(", ",FILTER(A2:A,B2:B=v)))))})
Great news for google-sheet lovers that google releases new lambda formulas. You can use BYROW() function to make it spill array. Try below formula.
=BYROW(C3:C9,LAMBDA(x,JOIN(",",FILTER(B3:B9,C3:C9=x))))
To refer entire column use FILTER() function for BYROW().
=BYROW(FILTER(C3:C,C3:C<>""),LAMBDA(x,JOIN(",",FILTER(B3:B,C3:C=x))))
Suppose my range of data from B3:C9, want to group the result according the the Column C (or Col2)
Here is the formula i googled without using the Lambda function
=ARRAYFORMULA(REGEXREPLACE(TRIM(SPLIT(FLATTEN( QUERY(QUERY({ROW(C3:C9), C3:C9&"×", B3:B9&","}, "select max(Col3) where not Col2 starts with '×' group by Col1 pivot Col2"),,7^7)), "×")), ",$", ))
Notice the 7^7 is the (length of the data)^(length of the data).
i.e. from 3 to 9, there are 7 data.
I prepared this example Google Sheet for this question since it is about the charts and trendlines, with the randomized input data available to view.
I have a chart that dynamically plots information gathered from a query about sales per week. It plots the sum of $ by week number. It is pulling data live, so that when we get the first sale of a new week, it skews the data significantly.
Example:
The trendline should obviously be positive, but due to next weeks new data adding such a small Y-value, the trendline becomes negative and the chart looks like we are having a major drop in business.
Charts & Trendlines (with the newest data manually removed):
Thoughts:
Manually restricting the chart's input to the past and current week. This shows the chart how I want it, but it doesn't work because I cannot manually go in and update the input range every week.
Instead of changing the chart, change the main query to ignore values after today(). This may work be a plausible route but it is a very large query and I do not want to run it twice. I have to keep the actual numbers for next week on the screen. I could make a hidden tab and re-run it there how I want and then base the chart off of that tab. Is this the only option?
This is purely an aesthetic presentation problem, so I myself understand why the chart has a drop off, but someone else might take a quick glance and think otherwise. If there are other more efficient or better ways to present such data, that would also be helpful.
with:
=IFERROR(ARRAYFORMULA(QUERY(QUERY({INDIRECT("Data!A2:D"),WEEKNUM(INDIRECT("Data!A2:A"))},
"select Col5,sum(Col2),sum(Col3),sum(Col4),count(Col5)
where Col1 is not null
and Col1 < date '"&TEXT(TODAY(), "e-m-d")&"'
group by Col5"),
"offset 1", )), "e")
you can get:
update:
try:
=IFERROR(ARRAYFORMULA(QUERY({
QUERY({INDIRECT("Data!A2:D"), WEEKNUM(INDIRECT("Data!A2:A"))},
"select Col5,sum(Col2),sum(Col3),sum(Col4),count(Col5)
where Col1 is not null group by Col5", ), IFERROR(
QUERY({INDIRECT("Data!A2:D"), WEEKNUM(INDIRECT("Data!A2:A"))},
"select Col5,sum(Col2),sum(Col3),sum(Col4),count(Col5)
where Col1 is not null and Col1 < date '"&TEXT(TODAY(), "e-m-d")&"' group by Col5")*SEQUENCE(ROWS(
QUERY({INDIRECT("Data!A2:D"), WEEKNUM(INDIRECT("Data!A2:A"))},
"select sum(Col2) where Col1 is not null group by Col5", )), 1, 1, 0))}, "offset 1", )), "e")
demo sheet
I'm creating a Budget calculator spreadsheet in Google Drive, I'm trying to update cells from another Sheet with certain criteria:
This is Sheet1:
According to the date and category should update a cell from another Sheet in the same document, with the quantity.
This is Sheet2:
I'm not sure If I'm able to implement this flow in the same Google spreadsheets or if I should use Python instead. I tried everything and I'm stuck here. If someone could give me a hint about it I'll appreciate it a lot.
Here's the link to the spreadsheet: https://docs.google.com/spreadsheets/d/1BEtKJGVOdVF8PLxcR_96cPjE_4XH0QFbtV9dynroly0/edit?usp=sharing
try this cobra query in B13:
=INDEX(IFNA(VLOOKUP(A13:A21, QUERY({Sheet2!A3:D;
TO_DATE(SEQUENCE(12, 1, 2, 33)), 0/SEQUENCE(12, 3,,)},
"select Col2,sum(Col4)
where Col2 is not null
group by Col2
pivot month(Col1)-1"), SEQUENCE(1, 12, 2), )))
I have been struggling with the Google Sheets query for several hours and maybe getting confused how to combine HLookup and VLookup (or any other function) in a way that can find the first and last occurrence of a value in a sheet based on the date header above it.
Here is an example sheet for reference which is very clear, but I will try explain verbally as well ... https://docs.google.com/spreadsheets/d/1rBVM7EtW3IREundWs_f2ftic-h4fEB97u4k4sZyIFNY/edit#gid=0
Given that I have a 2d range of cafeteria locations serving food on certain day (so the Y-axis headers of the table are cateteria locations and the X-axis headers are dates and the value is the name of the food served that day such as "Pizza") ... I want to have another table below that has a lookup for the first and last date that the food was offered. In my reference sheet I denoted that by Yellow highlight.
It seems like something that should be doable in a spreadsheet tool; unless it is impossible and I am not realizing it. Is such an operation possible?
delete range B10:C and use:
=INDEX(IFNA(VLOOKUP(A10:A, QUERY(SPLIT(FLATTEN(B1:E1&"×"&B2:E8), "×"),
"select Col2,min(Col1),max(Col1) group by Col2", ), {2,3}, 0)))
See if this helps
=query(ArrayFormula(split(flatten(text(B1:E1, "yyyy-mm-dd")&"~"&B2:E5), "~")), "Select Col2, min(Col1), max(Col1) where Col2 <> '' group by Col2 label Col2 'Food', min(Col1) 'First Offered', max(Col1) 'Last Offered' format min(Col1) 'yyyy-mm-dd', max(Col1) 'yyyy-mm-dd'", 0)
Change range to suit.
I am trying to execute as shown in the following google sheet link. I need to locate the first occurrence of two unique values in column H and I combined and input the Ratings as in the table.
Sample data
My efforts have been displayed in the sheet.
use:
=ARRAYFORMULA(IF(COUNTIFS(H2:H&I2:I, H2:H&I2:I, ROW(A2:A), "<="&ROW(A2:A))=1,
IFNA(VLOOKUP(H2:H&I2:I, SPLIT(FLATTEN(A2:A&{B1, D1}&"×"&{C2:C, E2:E}), "×"), 2, )), ))