I'm working on a timesheet dashboard for my office. My goal is to create summaries of weekly, monthly and yearly time spent on overhead vs. projects. I have based the formula on Player0's work that organize the data into weekly, monthly, and yearly results (all hours added up). I do not know how to separate overhead work from time on project work. Sample Sheet:
https://docs.google.com/spreadsheets/d/1IRtS60P256_fo-Yen1IKV4U6SkNpZJWc1Cf8Jeqw_20/edit?usp=sharing
Desired Output: Please refer to Sample Sheet, Dashboard tab, for example.
Generating TOTAL HRS should be simple in a Query function, by adding up OVHD HRS + PROJ HRS columns (once created).
Generating % PROJ HRS should be simple in a Query function with basic athematic.
What would we use to generate OVHD HRS and PROJECT HRS as new columns?
Thank you in advance for your insights.
Player0's post: Sort timesheet logged hours by week
I've tried using SUMIF function to create the additional columns within Query, but get an error (number of rows doesn't match...).
The one formula which do everything is here.
put the formula into C2 as shown in the images.
in A3, select in which method do you want to display the results.
in A4, select in which staff do you want to display the results.
This formula mainly uses QUERY() to modify data from the given range, togather with some other date functions.
=ArrayFormula(LAMBDA(SHOW,STAFF,
LAMBDA(RANGES,
LAMBDA(HEADERS,JBRAW,FFRAW,TGRAW,
LAMBDA(DATARAW,
LAMBDA(YEARS,MONTHS,MONTHLY,WEEKS,WEEKNUMS,TYPES,
LAMBDA(DATA,
LAMBDA(SHOWWEEK,ORDER,
LAMBDA(RESULT,
QUERY(IF(RESULT="",0,RESULT),"SELECT Col1,Col2,Col3,Col2+Col3,(Col3/(Col2+Col3)) LABEL Col2+Col3'TOTAL HRS',(Col3/(Col2+Col3))'% PROJ HRS' FORMAT (Col3/(Col2+Col3))'#,##0.00 %'",1)
)(QUERY(QUERY(QUERY(DATA,"SELECT "&SHOW&",SUM(Col6) "&SHOWWEEK&" WHERE Col2='"&STAFF&"' GROUP BY "&SHOW&SHOWWEEK&" PIVOT Col1",1),"ORDER BY "&ORDER,1),"SELECT Col1,Col2,Col3",1))
)(IF(SHOW="Col7",",Col5",""),IFS(SHOW="Col7","Col4 DESC",SHOW="Col8","Col1 ASC",TRUE,"Col1 DESC"))
)(QUERY({DATARAW,YEARS,MONTHS,WEEKS,WEEKNUMS,TYPES,MONTHLY},"SELECT Col10,Col1,Col6,Col7,Col8,Col5,Col9,Col11 LABEL Col6'YEAR',Col7'MONTHS',Col8'WEEKS',Col9'WEEK',Col11'MONTH'",1))
)(
YEAR(INDEX(DATARAW,,4)),
MONTH(INDEX(DATARAW,,4)),
TEXT(INDEX(DATARAW,,4),"mmmm"),
WEEKNUM(INDEX(DATARAW,,4)),
IFERROR("WEEK "&WEEKNUM(INDEX(DATARAW,,4))&" "&YEAR(INDEX(DATARAW,,4)),""),
IFS(INDEX(DATARAW,,2)="PROJECT #","TYPE",INDEX(DATARAW,,2)=0,"OVHD",INDEX(DATARAW,,2)>0,"PORJ")
)
)({HEADERS;JBRAW;FFRAW;TGRAW})
)(
ARRAY_CONSTRAIN(RANGES,1,5),
QUERY(RANGES,"SELECT "&JOIN(",","Col"&SEQUENCE(5,1,1))&" WHERE Col1 IS NOT NULL LABEL "&JOIN(",","Col"&SEQUENCE(5,1,1)&"''")),
QUERY(RANGES,"SELECT "&JOIN(",","Col"&SEQUENCE(5,1,7))&" WHERE Col7 IS NOT NULL LABEL "&JOIN(",","Col"&SEQUENCE(5,1,7)&"''")),
QUERY(RANGES,"SELECT "&JOIN(",","Col"&SEQUENCE(5,1,13))&" WHERE Col13 IS NOT NULL LABEL "&JOIN(",","Col"&SEQUENCE(5,1,13)&"''"))
)
)(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1IRtS60P256_fo-Yen1IKV4U6SkNpZJWc1Cf8Jeqw_20/edit#gid=1822160043","'D_Transpose'!A:Q"))
)(IFS($A$3="Weekly","Col7",$A$3="Monthly","Col8",$A$3="Yearly","Col3"),$A$4))
Related
I can't figure out how to solve my issue in google spreadsheet.
I have a column with some packages we want to release on our website on specific random dates. Not all fields in these column are populated, some are empty. For the populated ones I want to assign a random number between a range (A,B) which I take from other fields and have a max number of duplicates (the number of duplicates I take from another field).
For example I have 60 packages and I need to assign them between 1 and 31 (days of current month) so that means I will have 2 duplicates/day and I will put my duplicate field value to 2. But these 60 packages are shown in 80 rows for example, 20 rows empty, so those must not have any number assigned to them.
I have tried a few solutions with RANDBETWEEN and SORT etc but I did not manage to make it work. Now I switched to writing a custom function but I have never written one in google app scripts before, so if any of you guys have experience with this I would highly appreciate.
Random dates
Use this formula to get random dates between start date and end date appended randomly and duplicated only twice.
=ArrayFormula(IF(A2:A="",,
VLOOKUP(A2:A,
{SORT({ FILTER(A2:A,A2:A<>""),
RANDARRAY(COUNTA( FILTER(A2:A,A2:A<>"")),1) },2,1),
TRANSPOSE(SPLIT(REPT(TEXTJOIN(";",1,($E$1+SEQUENCE(DATEDIF($E$1,$E$2,"D"),1,1)))&";",$E$5),";"))},3,0)))
Sort chronologically
01 - paste in G2.
=SORT(QUERY(UNIQUE(QUERY({B2:B},"Select * where Col1 is not null ")), "where Col1 is not null"),1,1)
02 - paste this formula in H2 and drag down.
=IF(G2="",,TEXTJOIN(", ",1,FILTER($A$2:$A,$B$2:$B=G2)))
I am using the countifs function to add up a lot of different conditions - I need help to simplify the process so that it doesn't require so much manual formatting every time.
Here is a screenshot of a hypothetical spreadsheet. Here is a hypothetical scenario that will help convey my question. Let's say I am working with 3 clients, Macy's, abercrombie, and gap, to fill several open positions. We are reviewing multiple candidates. When I have reviewed them and approved, I select "yes" in the verdict column (E). When they have been processed, I selected yes in the F column. If I do not approve them, I select No in the column. So on and so forth.
So now I'd like to keep track of how many candidates I've approved and processed for each client for each open position. Here is my spreadsheet for that. I have used the countifs function from the previous spreadsheet, called "Review Document" as follows:
Column C, Row 2 - counting sales associate for abercrombie who have been approved and not yet processed:
=COUNTIFS(
'Review Document'!$B:$B,"abercrombie",
'Review Document'!$C:$C, "sales associate",
'Review Document'!$E:$E,"yes",
'Review Document'!$F:$F,"no")
I essentially do this for every single client, for every single role, for both column C and D. Imagine that there are ~300 rows with different companies and roles - The formula text changes every time to count if "position" and "company".
What I would like to do is now find an easy way to automatically apply a date range to all of these cells, without having to manually add a date criterion for every single formula. For example, in the first spreadsheet, there are dates in Feb, Mar, And April. Is there a way to apply a date range on my second spreadsheet so that it only counts the dates I specify? E.G. - apply some date range to ALL cells in that sheet so that it only counts if the date is 2/15/2022-3/31-2022? I would ultimately like to be able to change the date range quickly without having to manually add a date criterion to 300 cells, and then change it every time I want to see the numbers for a different date range. I was tinkering with conditional formatting but I haven't figured it out.
Thanks!
use:
=INDEX(QUERY(QUERY({A2:A, PROPER(B2:C),
IF((E2:E="yes")*(F2:F<>"yes"), 1, 0),
IF((E2:E="yes")*(F2:F= "yes"), 1, 0)},
"select Col2,Col3,sum(Col4),sum(Col5)
where Col1 is not null "&
IF(J1="",," and Col1 >= date '"&TEXT(J1, "yyyy-mm-dd")&"'")&
IF(J2="",," and Col1 <= date '"&TEXT(J2, "yyyy-mm-dd")&"'")&"
group by Col2,Col3"),
"offset 1", ))
community!
I have a table of 3 columns in Google Sheets: Date, Name, Amount.
I want to process data from it, so for every date in the list, there will be a full list of participants and amounts.
If there is no amount for specific date and person, it will be "0", or just leave it blank.
In addition, would like to count the percent of the sum of the amount for each person till the date in the corresponding row.
And it should be dynamically updated, so if a new row added with new name or date or both, so new participant will be added to every date in the output table and new full list of participants for the new date created.
For better understanding, here is the example of the data and output tables
What I've tried?
In MS access query it could be done not so hard.
Here I tried to create 2 new lists of unique dates and participants and connect them through use of CONCATENATE, ARRAYFORMULA, then SPLIT and some QUERY. All this through use of helping column of text, which should be edited manually for every new row...
The code in helping column:
=concatenate(arrayformula(if(isblank($F$3:$F),,";"&$E3&","&$F$3:$F)))
Then split code:
=query(arrayformula(split(transpose(split(TEXTJOIN(";",true,$G$3:$G),";",true,true)),",",true,true)),"Select Col1,Col2 where Col2 is not null order by Col1 ASC",0)
But here I stuck...
Want to pull the amounts for every corresponding date and participant, but...
FILTER reaches first, not existent in the original table combination, and doesn't proceed.
QUERY doesn't fetch the data fully automatically for all the list in the output table.
VLOOKUP gives only one row or complete mess, when use it recursively, or error...
So, how can I do this (if it's possible at all) in google sheets, and so all the output will be fully automatically updated?
Thank you very much!
Update - based on comments
I could not figure out a way to make this through one formula. If this works, you can have a hidden column (say H here) that totals the amount for the person till that date using the formula =QUERY(FILTER($E$3:$G, $F$3:$F = F3, $E$3:$E <= E3), "select sum(Col3) label sum(Col3) ''", 0) in H3.
Then in I3 you can find the % of total till date using the formula =QUERY(FILTER($E$3:$G, $F$3:$F = F3, $E$3:$E <= E3), "select sum(Col3) label sum(Col3) ''", 0)/SUMIF($E$3:$E, E3, $H$3:$H).
Both of the formulae in H3 and I3 need to be dragged down unlike the one in E3. Perhaps someone will be able to offer a better solution.
Previous answer
You can try something like this:
In E3 you can have the formula =ArrayFormula({(FLATTEN(SPLIT(REPT(FILTER(UNIQUE(A3:A)&"✦", UNIQUE(A3:A)>0), COUNTA(UNIQUE(B3:B))), "✦"))), (TRANSPOSE(SPLIT(REPT(JOIN("", FILTER(UNIQUE(B3:B)&"◼︎", UNIQUE(B3:B)<>"")), (COUNTA(UNIQUE(A3:A)))), "◼︎"))), (IFNA(VLOOKUP({(FLATTEN(SPLIT(REPT(FILTER(UNIQUE(A3:A)&"✦", UNIQUE(A3:A)>0), COUNTA(UNIQUE(B3:B))), "✦")))&(TRANSPOSE(SPLIT(REPT(JOIN("", FILTER(UNIQUE(B3:B)&"◼︎", UNIQUE(B3:B)<>"")), (COUNTA(UNIQUE(A3:A)))), "◼︎")))}, {A3:A&B3:B, C3:C}, 2, 0), 0))}). It is a little long but fills Columns E through G dynamically.
Then in H3 you can have the formula =ArrayFormula(IFERROR(((IFNA(VLOOKUP({(FLATTEN(SPLIT(REPT(FILTER(UNIQUE(A3:A)&"✦", UNIQUE(A3:A)>0), COUNTA(UNIQUE(B3:B))), "✦")))&(TRANSPOSE(SPLIT(REPT(JOIN("", FILTER(UNIQUE(B3:B)&"◼︎", UNIQUE(B3:B)<>"")), 3), "◼︎")))}, {A3:A&B3:B, C3:C}, 2, 0), 0))/(SUMIF((FLATTEN(SPLIT(REPT(FILTER(UNIQUE(A3:A)&"✦", UNIQUE(A3:A)>0), COUNTA(UNIQUE(B3:B))), "✦"))), (FLATTEN(SPLIT(REPT(FILTER(UNIQUE(A3:A)&"✦", UNIQUE(A3:A)>0), COUNTA(UNIQUE(B3:B))), "✦"))), G3:G))), "")). This one is dynamic as well.
I tried with your data and added a row on my own and it works.
I know it has already been a few times discussed topic, but I haven't found any help that would suit my problem yet.
I'm trying to make a sum of numbers in one column in a different Google sheet. The problem is I need to sum only those numbers happened in chosen month. I have the number of the month in the sheet where I need the function, and I have the month specifikation in a column next to the numbers.
All I came to till now is this (after many totally different codes):
=sum(query(IMPORTRANGE("xyz";"Výkaz!B23:C125");"select Col2,Col3 where "col2=G4";0)"))
G4 is the chosen month I have in the same sheet as this code
Please, could you help me figure this out? Thank you
Google Sheet 1 (TabName = "externalTab")
Google Sheet 2 (TabName = "InternalTab")
Use importrange to pull the all data from "externalTab" to "Internal Tab". Then just use a sumifs formula to add up values based on your criteria.
=IMPORTRANGE("https://docs.google.com/spreadsheets/d/1sLPGZkAVlxWfjhDMU9oa_cww0AI570Rtem0XCoOx0AE", "'externalTab '!A1:AF2000")
Alternatively use the following formula. Integers to be summed are located in column a/Col1 and Months are located in column b/Col2. There is one header row on the spreadsheet and we are adding up all the Integers that correspond to the month June.
=sum(query(importrange("https://docs.google.com/spreadsheets/d/1sLPGZkAVlxWfjhDMU9oa_cww0AI570Rtem0XCoOx0AE","a1:b1000"),"select Col1, Col2 WHERE Col2 = 'June'",1))
I have a pivot table with the cumultative number of shares for each stock and with different timestamps when a portfolio-change was made (invest or divest):
https://docs.google.com/spreadsheets/d/1IxdeBriRA9DgVclAWwfrz5ni1bZO94xwh0jFCghTLDg/edit?usp=sharing
Now I want to add the dates 'in between' (for every single weekday) the invest and the divest timestamps, where logically the cumultative numer of shares are more than zero.
Example 'Apple': I want the pivot table to show all the dates for every single weekday for Apple from 2013-05-08 to 2014-12-16 with the cumultative num of shares.
Example 'AT&T': Because there is no divest of AT&T Stocks, I want all the dates from 2020-04-06 to today.
I'd like to have this two examples with all the other stocks in one table to apply further functions. The purpose is to use the GOOGLEFINANCE function for the stock prices for each single day afterwards. But first, I need all the dates (where the number of shares is >0).
In the second sheet are the 'raw data'. I'm also fine if there is a better solution than using pivot table.
Thank you very much!
Greets Fabian
Please, see testFile.
Since your data contains large period of time, table with all dates included for all stocks would be really big and unusable so suggest to select one stock and create table for it.
Thus on testSheet in cell B1 you select stock name you are interested in.
In cell B2 select whether you want period for only historic data or up to date.
Following formula creates sequence of dates starting from first date for selected stock and up to date.
=ARRAYFORMULA(
IF($B$2="Today";
SEQUENCE(TODAY()-MIN(FILTER('Stock Track Record'!A:A;'Stock Track Record'!F:F=$B$1))+1;1;
MIN(FILTER('Stock Track Record'!A:A;'Stock Track Record'!F:F=$B$1));1)))
Then next formula gets values from your initial data.
=ARRAYFORMULA(
IFERROR(VLOOKUP($A$5:$A;
QUERY({'Stock Track Record'!$A:$F};
"Select Col1, Col2, Col3, Col4
Where Col6 = '"&$B$1&"'";0);2;0);""))
And following calculates cumulative number of shares:
=ARRAYFORMULA(IF(A5:A="";"";SUMIF(A5:A;"<="&A5:A;D5:D)))