Showing value in row itself but COUNT in summary of pivot table - google-sheets

I have a pivot table in google sheets. My data consists of rows where columns are "carton number", "product", "pallet number" (other, non-important, columns are omitted).
I want to generate a pivot table such that I get a summary of "what is on each pallet". Basically I've put into rows the "pallet number" and "product" and then into values "carton number". The value "carton number" is shown as "COUNT".
Of course, the problem is that this pivot table doesn't show the actual "carton number", it just shows "1" per each row, but the summary row of product/pallet shows the correct carton quantity.
Hence I had to put "carton number" also into "rows". Example sheet here:
https://docs.google.com/spreadsheets/d/1xpWYeG2aJCoqmnM53ubWUroKKJT5Zy-BiipauoXUHGw/edit#gid=799560604
What I want is to have a pivot table where, in the example above, there is only 1 value of "C. N." (carton number) - showing actual carton number; and the summary row at product/pallet level shows "COUNT" of the boxes, ie. how many boxes of product are on a specific pallet.
How can I achieve this?

paste in E1 cell and hide C:D columns:
=ARRAYFORMULA({"C.N."; IF(C2:C<>"", C2:C, D2:D)})

Related

Using "Max" summary in pivot table for data organized by non numerical hierarchy (Google Sheets)

In SheetA I've got a set of rows that have a "Rating Of Thing" column.
The rating of thing column assigns ratings that belong to a non-numerical hierarchy. On a separate sheet (SheetB), using a pivot table, I'd like to display certain items in that sheet based on their position in that hierarchy. However, since the "Rating Of Thing" list is non-numerical, I'm getting results like the following.
I'd like to know how to create some sort of "on the go" mapping when the pivot table handles the "Rating of Thing" column so that I can find the max or highest rating for each month and display it in the table.
Link to the live sheet is here
try:
=INDEX(REGEXREPLACE(""&SORTN(SORT({TEXT(MONTH(A2:A&1), "00")&"×"&A2:A, C2:C},
MATCH(C2:C, E2:E5, 0), 1), 9^9, 2, 1, 1), ".*×", ))

Query function to select all columns of an imported data set, starting from a specific column

I am looking to query specific columns of an imported dataset from a separate google sheet. Ideally, I would like to query all columns after the "product ID" column (refer to "Test Data Set"). The reason why I am doing this is that I need the product ID column to remain in a particular position in the "Final Destination Sheet" since the "Product ID"s will be used as a reference range for the index and match formulas on another tab of that sheet.
The formula I have so far to import and query the original dataset for the "Product ID" column is as so:
=QUERY({IMPORTRANGE("1aPpdSy5venMl97ayn7VwaOo_AcAtcoc6_l4a1loPhNI","Sheet1!A:D")}, "SELECT Col" &MATCH("Product ID", IMPORTRANGE("1aPpdSy5venMl97ayn7VwaOo_AcAtcoc6_l4a1loPhNI","Sheet1!A1:1"),0),1)
However, I am unsure how to make the formula understand to query up all the columns after the "Product ID" column. Do note, the test data set only has 4 columns and a set number of columns but the real data set I am working with will be dynamic so more columns can be added or deleted over time. (So I won't know what the finite column letter will be and if columns are deleted from the left of B then it might shift its position which is why I used the match function in my original formula to ID that specific column's location on the spreadsheet).
Thank you in advance!
Final Destination Sheet (where the data is imported to and where I am trying to query the original data for specific columns): link
Test Data Set (where the data is imported from): link
if you know the headers you can do:
=TRANSPOSE(QUERY(TRANSPOSE(IMPORTRANGE("1aPpdSy5venMl97ayn7VwaOo_AcAtcoc6_l4a1loPhNI",
"Sheet1!A:D")), "where lower(Col1) matches 'product id|size'", 0))
update:
=IMPORTRANGE("1aPpdSy5venMl97ayn7VwaOo_AcAtcoc6_l4a1loPhNI",
"Sheet1!"&ADDRESS(1, MATCH("Product ID",
IMPORTRANGE("1aPpdSy5venMl97ayn7VwaOo_AcAtcoc6_l4a1loPhNI",
"Sheet1!1:1"), 0))&":1000")
assuming headers are in row 1 this will look for a column called product id and import it and all the columns to the right of it

return row header if text present

On the sheet Dynamic 3-5 Checklist I want to use the cells in blue (columns B, D, F, etc.) as a reference to look for the text in the range B9:P21 on sheet Dynamic Grade 5, then display the words in column A.
For example, C1 on Dynamic 3-5 Checklist should be populated with the text Typing Program from B12 on Dynamic Grade 5. Also, the text from C1 appeared for any other project the name of that project from the A column would also appear in C1.
https://docs.google.com/spreadsheets/d/1lCgHPPXML5Ll9XsrMPXmNnHOEQO0RZP-aWSbMtiCfg4/edit?usp=sharingxxx
I added the formula on your sample sheet (C1, E1, G1, I1), please check if those cells show what you wanted to get.
Formula:
C1:
=textjoin(CHAR(10), true, arrayformula(if(isblank(B2:B), "", ifna(vlookup("*"&B2:B&"*", {'Dynamic Grade 5'!B$9:B,'Dynamic Grade 5'!$A$9:$A}, 2, false), ""))))
Breakdown of the important parts:
{'Dynamic Grade 5'!B$9:B,'Dynamic Grade 5'!$A$9:$A} - create an array where the 1st column is where the search term is to be searched, and 2nd column is the result we want which is column A
vlookup("*"&B2:B&"*" - pads the search term with wildcard to capture partial matches (multiple search terms can be found in one cell so normal vlookup fails)
textjoin with true - joins all results of arrayformula except blank cells
Output:
If you want to get only the unique values, prepend the arrayformula with unique.
=textjoin(CHAR(10), true, unique(arrayformula(if(isblank(B2:B), "", ifna(vlookup("*"&B2:B&"*", {'Dynamic Grade 5'!B$9:B,'Dynamic Grade 5'!$A$9:$A}, 2, false), "")))))
Note:
When copying the formula to other cells in 1:1 range, you only need to update the 1st column of {} array since B2:B correctly adjusts automatically when copied. See the pattern on the inserted formula on your sheet and you'll get the idea
UPDATE:
C2:
=ifna(join(CHAR(10), index(filter({'Dynamic Grade 5'!B$9:B, 'Dynamic Grade 5'!A$9:A}, 'Dynamic Grade 5'!B$9:B = B2), , 2)), "")

How to get data from concatenated strings in one cell to another table in Google Sheets?

for my use case, I have a Google survey that is connected to a main Google Sheet.
The survey has a 2 questions: 1. Name, 2. Multiple Choice from 1-31 (days of a month).
My survey results come into a by Google survey/Forms automatically generated table in Google Sheets with 2 columns: 'Name', and 'Which days?'. The 'Which Days?' column is has cells with a concatenated list of strings (e.g. '1, 3, 6, 8, 11').
The main Google Sheet has following structure: The first column is 'Name' that just imports the name from the Typeform Sheet (this works fine).
The remaining columns represent the days of the month (so up to 31 columns from 1-31).
Under each column, there are checkboxes.
The idea is that the checkboxes will automatically check according to the results from the Typeform (instead of checkboxes, we could also use colored cells if that is easier).
The problem:
How can I automatically get the data from the concatenated cell 'Which Days?' (e.g. '1, 3, 6, 8, 11') to the main Google Sheet (so that columns '1', '3', ..., '11' are checked/colored)?
Thank you!
You can use this formula on cell B2 of your main sheet (assume Sheet1 is your survey sheet and Sheet2 is your main sheet):
=IF(iferror(match(CELL("address",B2),ARRAYFORMULA(ADDRESS(ROW(B2),1+split(Sheet1!$B2,","))),0),0),TRUE,FALSE)
Then drag right and down to the end of the table.
Sample:
Explanation:
SPLIT creates an array of numbers based on your input delimited by commas.
ADDRESS creates a string of cell references. ARRAYFORMULA extends this to an array.
MATCH returns a valid value if the CELL reference of the cell position exists on the other table, else it will return error.
IF and IFERROR will return true or false depending on the value of MATCH.
use:
=ARRAYFORMULA(REGEXMATCH(COLUMN(B:K)-1&"",
"^"&SUBSTITUTE(SUBSTITUTE(IFNA(VLOOKUP(A10:A12, A1:B3, 2, 0)), " ", ), ",", "$|^")&"$"))

In Google sheets, How to do Vlookup unique data from multiple column

My Vlookup formula is the following currently:
(Weekly Consolidated Sheet)
Column C:1
=iferror(arrayformula(if(D:D="Item No.","Document No.",('For NAV'!C3:C))),"")
Column D:1
=iferror(arrayformula(if(A:A="Posting Date","Item No.",Unique('For NAV'!D2:D))),"")
Column I:1
=iferror(arrayformula(if(A:A="Posting Date","Quantity",sumif('For NAV'!D:D,D:D,'For NAV'!I:I))),"")
I would want to consolidate data from "For NAV" sheet into "Weekly Consolidated" Sheet.
"For NAV" Sheet has duplicate Item No. which I want to make it Unique and Sum the total Quantity (Column I)
Now that the document number seems to be the main Criteria I am stuck.
The following is what I need:
Main Criteria = Document No
Example:
ADW 01-07/03
-Item number which has same document number should consolidate its own Unique item number and sum the Quantity
ADW 08-14/03
-Item number which has same document number should consolidate its own Unique item number and sum the Quantity
Other columns is OK i can vlookup from "Item Listing" Sheet based on the Item code
Link for the spreadsheet as below:
https://docs.google.com/spreadsheets/d/1SL63pIF35skZjjbFjTRgfsbSYHvDr-gRRKciZbYFRUU/edit#gid=1168278681
Try changing your formula in I2 to
=ArrayFormula(iferror({"Quantity";sumif('For NAV'!C3:C&'For NAV'!D3:D,C2:C&D2:D,'For NAV'!I3:I)}))
The way this works is by making a unique string generated from the values on the C and D columns to compare between sheets. In this case you can simply joining them together because the the C column is always the same size.

Resources