Retrieve values from the top non-blank cells in a row - google-sheets

I have some data in sheet1,and sometimes the data starts in columns A4:C4, sometimes A8:C8, or sometimes another row. I'd like to get these data (only the first five rows of data) from sheet1 to columns A1:C5 in sheet2. So that every time the data is updated, only the first five rows of data will be retrieved from sheet1.
Can I a little help please, thanks in advance.
here is a sample sheet1 file.

I'd think this would work:
=ARRAY_CONSTRAIN(FILTER(Sheet1!A:C,Sheet1!A:A<>""),5,3)

A Query would also do the trick
=QUERY(Sheet1!A1:B,"select * Where A is not null limit 5",0)

Related

Syncing a cell from an outside sheet to multiple rows in the master sheet with IMPORTRANGE, SPLIT, TRANSPOSE

I am having issues with syncing some data from an outside spreadsheet to a master spreadsheet. The problem lies in the fact that there are multiple strings in each cell of the column I wish to sync. I have tried to solve the problem by using IMPORTRANGE to get the data from the I column (starting at I2 onwards), then splitting the strings and finally transposing them to get them into rows, which works well for the master sheet. I have written it like so:
={TRANSPOSE(SPLIT(IMPORTRANGE("spreadsheet_url","sheet_name!I2:I"),","))}
The problem is in the fact that this formula only works for the first cell (I2), despite the fact that I have specified the entire I column. It gets the correct range of data, but when I use SPLIT on it, it only takes the first one into account.
What am I missing? Is there a way to include a new row as a delimiter also in the SPLIT function and in which way?
Thanks a lot.
try:
=ARRAYFORMULA({TRANSPOSE(SPLIT(IMPORTRANGE("spreadsheet_url","sheet_name!I2:I"),","))})

Split ArrayFormula throwing #valueerror when data added to cells in range

Sorry for poor formatting ahead of time.
I have a Google Sheet that collects responses from a Form. What I am trying to do is take the URLs that are made from the file upload question on the form and split them into individual URLs in the same row. I had this working without issue previously and now when making a new sheet, the formula I am using is not working and giving me unexpected errors or data. Can't embed photos yet so links below.
Formula
Value Error
The formula will copy data from the reference cell if there is no comma, but if a comma is added to any cell in the column, the entire formula stops working. I am really not sure what the problem is as I said this worked just fine previously. Thanks in advance, I've been at this longer than I care to admit and I assume this is a simple problem that I have overlooked.
The reason why you encountered such issue is because you are trying to create an array with mismatched number of columns.
Based on your sample scenario, when you used ={"File1";arrayformula(iferror(split(Q2:Q,",")))} while your column Q2:Q data doesn't have a comma, arrayformula will return 1 column results. Row1 column count and the array formula result's column count matches.
But if Q2:Q data contains comma, arrayformula will return multiple column results which doesn't match in your row 1 column count
You can use this formula in cell R1:
=arrayformula(iferror(split({"File1,File2,File3,File4,File5,File6";Q2:Q},",")))
Output:

Insert row into data imported using IMPORTRANGE

I have two sheets:
SheetA contains dates. It is the reference data.
SheetB contains dates and data on events that occurred on those dates. This sheet is updated regularly.
I am using IMPORTRANGE in SheetB to pull data from SheetA.
I sometimes need to insert rows into SheetB. For example, sometimes two events occur on the same date and I need a row for each.
However, when I insert a new row into the imported data in SheetB the new row is automatically filled with IMPORTRANGE data from SheetA.
I think there may be a solution with ADDRESS but I can't figure it out. Any help would be much appreciated!
As long as IMPORTRANGE returns a single array of multiple rows you are not going to be able to split those apart at all easily. Your best bet may be to convert the array into a standard range (Ctrl+C/Ctrl+Shift+V) and start the process all over if the source changes.
You might be able to combine two ranges (one from each sheet) in a QUERY that you sort by date.

Last row in google sheets

I'm sure this will be answered VERY quickly but its beginning to do my head in!
I have a stockcheck spreadsheet in Google Sheets. The stock check is done on a tablet and the data is sync'd with google sheets whereby the data from that stock check is appended in rows consecutively.
So week 1 would transfer to row 1, week 2 to row 2 etc etc etc.
The number of items on the stock check may decrease or increase to the length so consequently so the row length will do as well.
I want to transfer that raw data to a second sheet but only the last row, so I can in effect get the data from the most recent stock check.
I've tried numerous functions and can return both the number of the last row and the value of the first column in the last row.
I'm just at a complete loss in returning the values of the entire last row. Please help!
Without an example of your inventory sheet, I had to make one that is extremely simple (only has 3 columns). Next time, it would be helpful if you shared a link to your sheet (or at least made a copy of your sheet with insensitive data that you could share with us). Baring that data, I had to assume that you want the LATEST inventory row, and that you have a column with the date of the inventory in it...
Here's the sheet I created:
https://docs.google.com/spreadsheets/d/1_H73BKJJDYdJYmKz6C_qDCzQ5TaByo6PcED2nRFCDBQ/edit?usp=sharing
Basically, I created a filter in Cell A1 that gets all the columns in your range, and then returns that data filtered by all dates that are in the past, orders the array by date, and then limits the rows returned by 1 (and the columns by the number of columns in your range):
=array_constrain(sort(filter($A$4:$C,$A$4:$A<=today()),1,false),1,columns(A:C))

match values from a range into each row of a table in Google Sheets

I've been working on a multi tiered drop down program, and in filtering one of the tables I stumbled upon a problem I can't find any help on.
Basically, I have 2 sheets. Sheet1!A2:A has a set of values. In this example, A2=110, A3=114, A4=162. However, with each use of the program, there could be any number of values and the values could change.
In the second sheet, Sheet2! there is a table. The first row has the headers that I want to return from my search. Under each header is a series of numbers ranging from 3 to well over 50 values. And the number of columns is also unknown...(it will keep getting larger).
So I want to know which columns have all 3 values from Sheet1!A2:A in them.
Column 3 might have 6 numbers (95,110,114,125,150,162) and column 7 might have (80,110,114,125) so I would want to return the header from Column 3 but not from column 7.
Does any of this make sense? Again in simple terms, I want to query all of the columns in Sheet2 to see which contain all of the values from Sheet1!A2:A
Any help would be so greatly appreciated...
-Daniel
I set up an sheet using your example data:
https://docs.google.com/spreadsheets/d/169VrbWkTlRMzhNPe4G8hQL1MdfqQuTvjb87aRD9hiWo/edit#gid=1923440782
I've restricted the formula in cell D2 to 500 rows for the sake of speed but you can remove the references to make it work across the whole sheet:
=FILTER(Sheet2!1:1,ArrayFormula(TRANSPOSE(mmult(TRANSPOSE(COUNTIF(A2:A500,Sheet2!A2:Z500)),TRANSPOSE(split(rept("1,",COLUMNS(TRANSPOSE(COUNTIF(A2:A500,Sheet2!A2:Z500)))),",")))=count(A2:A500))))

Resources