Insert row into data imported using IMPORTRANGE - google-sheets

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.

Related

Importing data from another sheet where the entire row is not duplicated

I have a Google Sheet which has basic test data.
I need to import every row where the entire row is completely unique.
If any data in a row is different it should pull through to the other sheet.
Here is my test sheet with the data in 'Duplicate Rows'! and the data pulling through as is into 'Import'! https://docs.google.com/spreadsheets/d/1D1H2FLdyzr2iFwr_ENg6t2OAAsS8f71Mb4P5T_dtJ6g/edit?usp=sharing
I was going to use data validation to remove repeated rows from in the imported sheet but I can't find advice online that will consider the entire row rather than duplicate cells.
Either way I need to prevent these repeated rows.
You can use
=INDEX(UNIQUE(A1:C8))
(Do adjust the formula according to your ranges and locale)

Is there a formula to resolve duplicates in one column by looking at a second column?

I have a google sheet with 2 columns, A (containing names) and B (containing dates).
there are quite a few duplicates in A which I need resolved by looking at B and selecting the row with the soonest date.
Ideally I need to extract the data to make a list on another sheet with no duplicates, being resolved by the above method. the issue is that there might be new rows added to the sheet, and I need the new rows checked against the existing data to confirm it has a sooner date compared to potential duplicates. how can I formulate this?
There is probably a better way, but I just use the query function to put the results in a different sheet so I don't mess with the source data.
=QUERY()
Here is some examples on how it is used: https://support.google.com/docs/answer/3093343
As for the query itself, something like this should work. A being the first column (Name), and B being the second column (Date).
SELECT A, MAX(B) GROUP BY A

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"),","))})

Countifs function returns 0 in certain rows

I've recently started using Google Sheets for my new job and I need help with a little problem.
I created a function to compare a whole column of dates from a sheet with dates from another column on another sheet to filter the given count.
The code is as follows:
COUNTIFS('raw data'!$D$2:$D$952;">="&('2nd table'!$C$3:$C$52);'raw data'!$D$2:$D$952;">=01.08.2021";'raw data'!$D$2:$D$952;"<=31.08.2021")
raw data contains dates in column D. I've used 952 because that is the maximum range I can get. I've yet to solve how to implement this via named ranges.
2nd table contains the dates our employees started working at the company. I wanted to filter out the data that exists before their time at our company within raw data column D.
The function does return the correct value sometimes and sometimes it just returns 0.
If I boil down the function to just contain this:
=COUNTIFS('raw data'!$D$2:$D$952;">="&('2nd table'!$C$3:$C$52))
I get different values each time. I suspect that I cannot use the function in this way because the 2nd table got a different amount of rows to compare from.
How can I work around this issue if that's the problem and why does the function even work sometimes?

Google Sheets Formula for Pulling Specific Values in Two Ways

I'm trying to do a couple of different things with a spreadsheet in Google and running into some problems with the formulas I am using. I'm hoping someone might be able to direct me to a better solution or be able to correct the current issue I'm having.
First off all, here is a view of the data on Sheet 1 that I am pulling from:
Example Spreadsheet
The first task I'm trying to accomplish is to create a sheet that lists all of these shift days with the date in one column and the subject ("P: Ben" or S: Nicole") in another column. This sheet would be used to import the data via a CSV into our calendar system each month. I tried doing an Index-Match where it used the date to pull the associated values however I found that I had to keep adjusting the formula offsets in order to capture new information. It doesn't seem like Index-Match works when multiple rows/columns are involved. Is there a better way to pull this information?
The second task I am trying to accomplish is to create a new tab which lists all the dates a specific person is assigned too (that way this tab will update in real time and everyone can just look at their own sheet to see what days they are on-call). However, I run into the same problem here because for each new row I have to change the formula to reflect the correct information otherwise it doesn't pull the correct cell when it finds a match.
I would appreciate any and all information/advice on how to accomplish these tasks with the formula combination I mentioned or suggestions on other formulas to use that I have not been able to find.
Thanks in advance!
Brandon. There are a few ways to attack your tasks, but looking at the structure of your data, I would use curly brackets {} to create arrays. Here is an excerpt of how Google explains arrays in Sheets:
You can also create your own arrays in a formula in your spreadsheet
by using brackets { }. The brackets allow you to group together
values, while you use the following punctuation to determine which
order the values are displayed in:
Commas: Separate columns to help you write a row of data in an array.
For example, ={1, 2} would place the number 1 in the first cell and
the number 2 in the cell to the right in a new column.
Semicolons: Separate rows to help you write a column of data in an array. For
example, ={1; 2} would place the number 1 in the first cell and the
number 2 in the cell below in a new row.
Note: For countries that use
commas as decimal separators (for example €1,00), commas would be
replaced by backslashes () when creating arrays.
You can join multiple ranges into one continuous range using this same
punctuation. For example, to combine values from A1-A10 with the
values from D1-D10, you can use the following formula to create a
range in a continuous column: ={A1:A10; D1:D10}
Knowing that, here's a sample sheet of your data.
First Task:
create a sheet that lists all of these shift days with the date in one
column and the subject ("P: Ben" or S: Nicole") in another column.
To organize dates and subjects into discrete arrays, we'll collect them using curly brackets...
Dates: {A3:G3,A7:G7,A11:G11,A15:G15}
Subjects: {A4:G4,A5:G5,A8:G8,A9:G9,A12:G12,A13:G13,A16:G16,A17:G17}
This actually produces two rows rather than columns, but we'll deal with that in a minute. You'll note that, because there are two subjects per every one date, we need to effectively double each date captured.
Dates: {A3:G3,A3:G3,A7:G7,A7:G7,A11:G11,A11:G11,A15:G15,A15:G15}
Subjects: {A4:G4,A5:G5,A8:G8,A9:G9,A12:G12,A13:G13,A16:G16,A17:G17}
Still with me? If so, all that's left is to (a) turn these two rows into two columns using the TRANSPOSE function, (b) combine our two columns using another pair of curly brackets and a semicolon and (c) add a SORT function to list the dates in chronological order...
=SORT(TRANSPOSE({{A3:G3,A3:G3,A7:G7,A7:G7,A11:G11,A11:G11,A15:G15,A15:G15};{A4:G4,A5:G5,A8:G8,A9:G9,A12:G12,A13:G13,A16:G16,A17:G17}}),1,TRUE)
Second Task:
create a new tab which lists all the dates a specific person is
assigned too (that way this tab will update in real time and everyone
can just look at their own sheet to see what days they are on-call).
Assuming the two-column array we just created lives in A2:B53 on a new sheet called "Shifts," then we can use the FILTER function and SEARCH based on each name. The formula at the top of Ben's sheet would look like this:
=FILTER(Shifts!A2:B53,SEARCH("Ben",Shifts!B2:B53))
Hopefully this helps, but please let me know if I've misinterpreted anything. Cheers.

Resources