Google Sheets referencing another sheet every nth row - google-sheets

In Google Sheets, I want to grab the text value from a sheet and put it every three rows in a separate sheet. I want there to be blank spaces in the rows in between.
For example, say I have a list of names on a sheet called "Customer Info" In Column A. On a separate sheet, I am keeping track of interactions with customers, and that data takes 3 rows. Every third row, I want to grab the name of the next customer from my sheet "Customer Info" and put it in column A of my sheet "Transactions."
I've been trying to find a way to use something like ='Customer Info'!A(x), and use a formula to get the value of x. I thought some variation of MOD would work.

Say Sheet2 is like:
In Sheet3 cell A1 enter 1 and in A2 enter:
=IF(MOD(ROW(),3)=1,1+MAX($A$1:A1),"")
and copy downwards. In B1 enter:
if(A1="","",index(Sheet2!A:A,A1))
and copy downwards:
You can change the number of empty rows by changing the arguments to MOD().

try:
=INDEX(TRIM(FLATTEN(SPLIT(QUERY(INDIRECT("Customer Info!A2:A"&
COUNTA(A2:A)+ROW(A2)-1)&"♀ ♀ ♀",,9^9), "♀"))))

Related

How to drag copy a data validation and increment the column letter

I'm trying to make a drop-down list in my spreadsheet, my spreadsheet has a couple of sheets but the main two sheets are "Master" and "Sheet3".
I have made the drop-down list using the Data -> Data validation as shown in the below screenshot:
And in the "Sheet3" sheet there is a big table (1000 columns) of data that I want to make a drop-down list from, from each column in it.
Now what I want is to drag copy this cell down so that the criteria will be like this:
=Sheet3!A1:A
=Sheet3!B1:B
=Sheet3!C1:C
=Sheet3!D1:D
...etc
and so forth for 1000 rows, but when I do this, it does not increment the column letter, it's just like the first cell criteria value (=Sheet3!A1:A) for all other rows.
Is there a way to make this work without me having to edit each row in this 1000-row column manually?
Thank you all.
We have Sheet3 with 1000 column and we want to get a drop down of all 1000 column in Master sheet in a single column.
Solution
01 - Transpose Sheet3 to use it as a source of Data validation.
=TRANSPOSE(Sheet3!A1:999)
02 - Go to Data validation and set the range to ='Sheet3 Transposed'!1:1 as soon as you click save it automatically changes to ='Sheet3 Transposed'!$1:$1 with a abslout refrence just change it back to ='Sheet3 Transposed'!1:1 with removing $ dollar signs.
03 - Copy the the drop down cell D2 and paste it in the range D2:D1001, we get Error: Invalid Input must fall within specified range, in the whole range D2:D1001, to solve it copy the range 'Sheet3 Transposed'!A1:A1000 and in D2 right click: paste special > Values only
enjoy :D

Trying to auto-generate SKUs in Google Sheets using prefix and sequence number but it breaks when sheet is sorted

I want to automatically generate unique, incremented ids (SKUs) for products in my inventory using Google Sheets. These SKUs should be immutable and not change when the sheet is sorted. This screenshot shows my flawed attempt to do this:
The formula I have for column A is:
=if($B2<>"",$B2 & TEXT(COUNTIF($B$2:$B2,$B2),"-0000"),"")
That formula appears to give the desired result. However, if I sort by the values in Column C, SKUs become associated with different Item Names, which is a problem. How can I modify the spreadsheet to get immutable, auto-generated SKUs?
Update:
I would like to be able to add additional rows/SKUs to the sheet over
time
Here is a link to the sample spreadsheet
I've added a sheet ("InventoryMaster(Unsorted") to your spreadsheet.
This sheet would be used to add your prefixes and items only. Once added, you would never sort, insert rows, delete rows or items, etc. Just keep adding the next prefix and item into the next open row, in Col B and Col C. Col A has a formula that will create the static SKUs from that unchanging and ordered information. (I've hidden that formula-containing Col A, so that you only have to enter the manual data and don't have to worry about accidentally overwriting the formula or its results. It's still there at all times, serving its purpose in the background.)
Then, other sheets (see my added "Erik Help" sheet) can reference that "immutable" list, giving you the ability to sort without losing SKU connection.
Here is the A1 formula from the 'InventoryMaster(Unsorted)' sheet:
=ArrayFormula({"SKU";IF(B2:B="",,B2:B&TEXT(COUNTIFS(B2:B,B2:B,ROW(B2:B),"<="&ROW(B2:B)),"-0000"))})
And here is the SKU-assigning formula from A1 of the "Erik Help" sheet:
=ArrayFormula({"SKU";IF(B2:B="",,VLOOKUP(B2:B&C2:C,{'InventoryMaster(Unsorted)'!B2:B&'InventoryMaster(Unsorted)'!C2:C,'InventoryMaster(Unsorted)'!A2:A},2,FALSE))})

How to make a dynamic import command from one sheet to another in google sheets

I want to build a tool that lets me insert a spreadsheet in a given format into sheet1. Then it takes some data and inserts it into a specified location in sheet2.
I am using functions in the following format at the moments:
=Sheet1!AI2
For every column, I need the data from all rows i.e sheet1 A1 to sheet2 B2, Sheets A2 to sheet B3 ...
There are hundreds of rows and I don't want to copy-paste it and manually change the row number.
Is there a way to do it like this:
=Sheet1!AI(rownumber-1)
That way it would work for all rows.
Thanks for taking the time and reading this!
Try putting this in Sheet2!B2
=ARRAYFORMULA(Sheet1!AI:AI)
or this (it will give you the same result):
=INDEX(Sheet1!AI:AI)
Be sure that Sheet2 has at leas one more row than Sheet1. Google Sheets will automatically add 500 new rows, but if the numbers of rows in those sheets are codependent than rows will be added in a loop up until the limit.

Automatically Change Sheet Reference in formula

I have hundreds of sheets, with one master sheet, and I have this formula in my master sheet
=IF(COUNTIF(Sheet2!M$2:M$11,"No")>0, "Y", "N")&COUNTIF(Sheet2!M$2:M$4,"No")&COUNTIF(Sheet2!M$2:M$7,"No")&COUNTIF(Sheet2!M$2:M$11,"No")
which basically grabs the number of yes or nos in a column from the referenced sheet, in this case 'Sheet2', and returns Yes, if there are multiple NOs in the column, and the other arguments just return the count of NOs in the cell ranges.
I just want to drag down the formula in the column it is located in, and have the Sheet reference change from Sheet2 to Sheet3, Sheet4, and so on, but it simply copies it down the column. I've tried looking into it, got some hints with using INDIRECT but I'm returning errors left and right that I'm not sure if I'm on the right track.
EDIT: sample data: https://docs.google.com/spreadsheets/d/1jcbjUs4Ho0LlXF-Olu5NkEw4THqaA0nB5dduYKfx5S8/edit?usp=sharing
I have successfully used below formula to count "No's" using a sheet reference from a cell. Try it out:
=IF(COUNTIF(INDIRECT("Sheet" & A1 & "!" & "A:A");"No")>0;"Y";"N")
You can change the column range to suit your need - I just used column "A" in each sheet and cell "A1" with the sheet reference, in the above case A1 contained the number 2 referring to "Sheet2".
You can replace the Sheet2!M$2:M$11 with the following:
INDIRECT("Sheet"&ROW()-1&"!M$2:M$11")
You have of course to replace the M$2:M$11 with the respective range references.

Google sheet formula that finds row name and returns column headers based on marked cells

I'm trying to return the column headers for a row that is marked with an x. The row is selected from a name in the left column. I'm stuck here.
I can illustrate what I want to do by showing these images:
Start table
The result I want is this:
Outputs of the possibilities for the first sheet
I have put more information in my Example Sheet.
Link to editable example sheet
This formula should create a table (with a single formula) with the months in one column and the headers in the second column.
=ArrayFormula({A4:A15\ substitute(transpose(query(transpose(if(B4:G15="x";B3:G3&char(10);));;rows(A4:A15)));" ";)})
If you'd want to 'lookup' the months you manually type in you can wrap the above in a vlookup. Example:
=ArrayFormula(if(len(L4:L); vlookup(L4:L; {A4:A15\ substitute(transpose(query(transpose(if(B4:G15="x";B3:G3&char(10);));;rows(A4:A15)));" ";)}; 2; 0);))
You can check out both formulas in the copy of the sheet I've made in the spreadsheet you shared.

Resources