I have a pivot table in google sheets that references source data in a separate tab. Here's example raw data contained in the tab "MAR21 Powders" (only included the pertinent fields):
Jar Type Qty Needed In Next 2 Weeks
Black Jar 500 Yes
White Jar 500
White Jar 500 Yes
Clear Jar 1000 Yes
Right now, my pivot table only looks at the Jar Type and the Qty columns and does a SUM of the Qty field. The range is: 'MAR 21 Powder'!A1:W235
Here is the pivot table output on a tab called "Pivots":
Jar Type Qty
Black Jar 500
White Jar 1000
Clear Jar 1000
I would like to have a 3rd column that takes that "Needed in the Next 2 Weeks" column into account and displays the following:
Jar Type Qty Qty Needed In Next 2 Weeks
Black Jar 500 500
White Jar 1000 500
Clear Jar 1000 1000
As you can see, the 3rd column only adds the qty if the "Needed In the Next 2 Weeks" column says "Yes" within the source data on the "MAR21 Powders" tab. So, for the White Jars, 1000 are needed in total but only 500 are needed in the next 2 weeks.
How would I go about this to be able to add this 3rd column to the pivot table? Or, if it's easier, how can I add a global filter at the top of the page that let's me filter on "Needed In the Next 2 Weeks = Yes" keeping in mind I have a separate pivot for Jars, Lids, and Scoops. So, it would need to work for all 3 at once.
Thanks,
Alex
add a column to the right of the "Needed In Next 2 Weeks" Yes/No column on your raw data.
Assuming that raw data you showed here is in columns A:C (i know it's not, just for the sake of explanation)
so in column D, title the column:"Qty Needed In Next 2 Weeks", then you would put =IF(C2="Yes",B2,0)
Now you should have a new column available in your pivot table to sum and you can add it like you would any other Field.
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)))
My source file columns look like this.
Is there any condition based column update function that checks the 2 columns and updates the result as below
If it is acceptable for those rows where %Completion 1 & %Completion 2 are both either blanks or errors to return 0.00% in the result column rather than blank as in your example (and assuming that your source columns are in A1:Bx), you can try the following in C1:
={"RESULT";arrayformula(mmult(n(iferror(offset(A2:B,,,max(filter(row(A2:A),not(isblank(A2:A))),filter(row(B2:B),not(isblank(B2:B))))-1))),{1;1}))}
You will need to change the number format of column C to percentages using the toolbar.
I am currently working with Google Forms and want to rearrange the way the responses are being displayed on the "Response Sheet". The only way I can think of doing this is by importing or moving the data to another sheet that would select and transpose certain columns if Column A contains key value.
This is what I'm seeing as part of the input and would like to see as the output if Column A Contains certain text:
Input & Output
Thank you in advance for your help!
O.K.
I rewrite headings a2:e2,
I take whole first five columns without headings e3:e6
I display content of columns A,B,F,G,H for all the rows that have 'A1' in column 1
I take tables built in point 1 and 2 together and sort them by first column
My solution is here:
https://docs.google.com/spreadsheets/d/1n7Ppd8v75mb3qrnJz_Jh_b4HNaj4i56X9wRGnz0l6i8/copy
={A2:E2;
sort({A3:E6;
query(A3:H6,"select A,B,F,G,H where A ='A1'",0)})
}
I have a spreadsheet of my department's priorities and initiatives for the year, it has about 10-15 columns. I'd like to create a series of executable buttons to place at the top of the report for easy access to filtering the sheet by certain values. For example, one button may say "show completed items" and when clicked the script would sort the "Status" column show only the rows with completed as the value in that column. The trick here is that I want these filters to run by clicking on the image so they would need to be done in script. I'm a beginning user of scripts so any help would be much appreciated.
In my sheet these are the column headers
Col 1 Pillar
Col 2 Strategy
Col 3 Initiative
Col 4 Priority
Col 5 Quarter Delivered*
Col 6 P&C Owner
Col 7 Partners
Col 8 Current Status
Col 9 Start Date
Col 10 End Date
Col 11 Status Notes
Thank you
The best way is to save your filters. Saved filters are accessible by all viewers.
For steps on how to do this, go to Filter your data, scroll down so you see "Create, name, and save a filter view", then select "Create and save filter view"
After you saved your filter views, you can access them from the drop down menu on the filter button.
Google has some great documentation for their Apps Script, which includes help with writing scripts for Google Sheets. Just go here and click "Build an add-on", and I'm sure SO would be glad to help once you come up with some more specific programming questions.
I know how to use Subtotal when I only need a breakdown by 1 column. But I have a sheet with 2 sort level. I need to get counts based on values for each of the second level sort. To clarify, I need something like this: assuming Col A is primary sort and Col B is secondary.
A B Count
Walmart Shoes 20
----------
Walmart Socks 10
Walmart Shirts 25
Target Socks 50
Target Jeans 5
Target Shirts 10
etc... (Not sure how to make this prettier(more readable).
Can the Subtotal function do this or do I have to get into Pivot Tables (Group, etc)? Thanks in advance?
Seems like this would be a situation that would call for a Pivot Table.
To create the pivot table select one of the cells in the raw data (Columns A through C in the picture). Then select the Insert Tab >> PivotTable >> PivotTable. You'll have the choice of putting the PivotTable on another worksheet or the one that contains the data (as shown).
Check A, B and C as seen in the picture, the choice of area should be done automatically, however if one of them does not automatically appear in the correct area (as shown) you can drag it.
Under PivotTable Tools select the Design tab and then Report Layout and Show in Tabular Form.
To the left of Report Layout is Grand Totals which you would turn off to make the pivot table look more like the table in your example.
To the right of Grand Totals is Subtotals which you would also turn off by choosing Do not show.
If it is important that Walmart precede Target, select the down arrow in PivotTable cell containing A (E2 in the picture), and sort Z to A.
Hope this helps.