Conditional Formatting & Importrange using 2 spreadsheets - google-sheets

I am requiring specific cells of a Google spreadsheet to be conditionally formatted based on information in a different spreadsheet.
The information is input into column J of a spreadsheet titled 'Haulage' and in a worksheet with the same name. I then require any cell in the range AE15:AH101 in a spreadsheet titled 'EMU Database' and in a worksheet titled '350' to be highlighted in a colour should the information in this cell match the information input into column J of the 'Haulage' spreadsheet/worksheet
ie '271' is in cell AE15 of the worksheet '350' (in 'EMU Database' spreadsheet) and when I input the same value into cell J3 of the worksheet 'Haulage' (in the 'Haulage' spreadsheet), AE15 is highlighted in the chosen colour.
I have tried using the following formula in the conditional formatting custom formula:
=A15=IMPORTRANGE("1AGMJxw5D5TNFI19dvpPCT0Jl6QNu5rRX1bcLqHYJ0-w", "Haulage!J3:J")
But not been able to make it work unfortunately.
For reference, both of the spreadsheets have been linked together and access has been granted between the 2 spreadsheets
Progress report:
I have been playing around with the importrange options in making this conditional formatting work and I have managed to get it to work by importing the data into the same spreadsheet and then using a formula between worksheets as detailed below:
Data from "Haulage" spreadsheet and "Haulage" worksheet within this spreadsheet is transferred to "EMU Database", into a worksheet titled "Sheet5" using the standard importrange function. In the cells I require the custom formula to work I have then used the following custom formula:
=match(AE15,indirect("Sheet5!A1:A"),)
This offers a solution to my problem and works as I require it, however I would still like to find a solution to avoid having to transfer the data from one spreadsheet to another before the formula works. I have tried to amend the above formula in a number of ways to incorporate an IMPORTRANGE but without success. My most recent failing is below:
=match(AE15,indirect,importrange("1AGMJxw5D5TNFI19dvpPCT0Jl6QNu5rRX1bcLqHYJ0-w", "Haulage!J3:J"),)
If anyone has any ideas on how to make the importrange work on this match formula it would be appreciated as it keeps things tidier for me than having extra worksheets with duplicate data from another spreadsheet
Follow up information for #player0
Links to the test versions of the relevant spreadsheets are below:
Haulage SS = https://docs.google.com/spreadsheets/d/1elDxSOLSG-6U-jC6E5fgcKeJDNf9Kcu7GRGvK5p6fr4/edit?usp=sharing
EMU Database SS = https://docs.google.com/spreadsheets/d/1poWzun1TvIhdlrHQyM_tSvJzEHFDpvZz7O-Ta0mvAR8/edit?usp=sharing
Within the "Haulage" spreadsheet, only the 'Haulage' worksheet is of interest - please disregard the other worksheet.
Within the "EMU Database" spreadsheet you will find my current conditional formatting in cell range AE15:AO71 of worksheet '390'. This formatting is linked to the worksheet titled 'Sheet5' which contains the data that I have used the importrange formula (see cell A1 of this worksheet) to pull from cells J3:J of the Haulage spreadsheet.
Basically, what I require of the conditional formatting is for any data in cell range AE15:AO71 of the '390' worksheet which matches data entered in cell range J3:J of the "Haulage" spreadsheet to be highlighted with a coloured box - but I want this to happen without the need for the extra worksheet with the imported data in

try:
=MATCH(A1, FILTER(
IMPORTRANGE("1elDxSOLSG-6U-jC6E5fgcKeJDNf9Kcu7GRGvK5p6fr4", "Haulage!J3:J"),
IMPORTRANGE("1elDxSOLSG-6U-jC6E5fgcKeJDNf9Kcu7GRGvK5p6fr4", "Haulage!J3:J")<>""), 0)

Related

In Google Sheets, can I query sheets from the current workbook as well as sheets from a second workbook together in the same array?

I have a formula that currently queries four sheets in the same workbook:
=IFNA(QUERY({'Sheet1'!A2:J;'Sheet2'!A2:J;'Sheet3'!A2:J;'Sheet4'!A2:J},"select Col2,Col5, ...
I want to add a fifth sheet into the array that's actually kept in another workbook. As much as it would solve all my problems, I can't bring the data into the same workbook as the other sheets due to privacy/permissions issues. I've tried doing this:
=IFNA(QUERY({IMPORTRANGE("<url>","'New Sheet'!A2:J");'Sheet1'!A2:J;'Sheet2'!A2:J;'Sheet3'!A2:J;'Sheet4'!A2:J},"select Col2,Col5, ...
... but it gives me an error "Unable to parse query string for Function QUERY parameter 2: lower takes a text parameter."
Is there any way to incorporate an importrange into the sheets array of a query?
01 - Paste this in a separate cell first and allow access.
IMPORTRANGE("<url>","'New Sheet'!A2:J")
02 - and then your formula
=IFNA(QUERY({IMPORTRANGE("<url>","'New Sheet'!A2:J");
'Sheet1'!A2:J;
'Sheet2'!A2:J;
'Sheet3'!A2:J;
'Sheet4'!A2:J},"select Col2,Col5,...
If that doesn't work, try using UPPER or nested LOWER(LOWER()) instead of LOWER elsewhere in your formula.

How to connect two google sheet workbooks using SUMIFS?

I have the following formula
SUMIFS(Sheet1!I2:I12,Sheet1!H2:H12,"1111-1111",Sheet1!B2:B12,"1111")
I want the Sheet1 from a separate workbook (not sheets in the same workbook), how can I do this?
My workbook1 is https://docs.google.com/spreadsheets/d/1L4t2xkmHPAOn8uGT3bFy56UMWrZaHsyq4FlOh6uR2g0/edit?usp=sharing
I want to do following in workbook2
= SUMIFS(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1VayuaMlSMvkhBKKuQnRTuTwk6kshFWQanWxa5KWh2ag","Sheet1!I2:I12"),IMPORTRANGE("https://docs.google.com/spreadsheets/d/1VayuaMlSMvkhBKKuQnRTuTwk6kshFWQanWxa5KWh2ag", "Sheet1!H2:H12"),"1111-1111",IMPORTRANGE("https://docs.google.com/spreadsheets/d/1VayuaMlSMvkhBKKuQnRTuTwk6kshFWQanWxa5KWh2ag", "Sheet1!B2:B12"),"1111")
use:
=QUERY(IMPORTRANGE("1L4t2xkmHPAOn8uGT3bFy56UMWrZaHsyq4FlOh6uR2g0", "Sheet1!A:I"),
"select sum(Col9)
where Col8 = '1111-1111'
and Col2 = 1111
label sum(Col9)''")
You can use the IMPORTRANGE formula to pull data from another sheet.
You can either embed the IMPORTRANGE in your formula in order to pull directly from it, or you can use the formula on its own in a new sheet, and pull from the sheet located within the same Spreadsheet for ease of access and a shorter formula overall.
Updating the spreadsheet you are pulling from will automatically update the data coming from the IMPORTRANGE formula.
For example:
A1 contains the basic formula =importrange("https://docs.google.com/spreadsheets/d/1I8BiB-2gSFueLIKiGsMY-URLOpnB8QzbUrx8/edit#gid=0", "Sheet1!I1:I12")
while B1 contains =sum(importrange("https://docs.google.com/spreadsheets/d/1I8BiB-2gSFueLIKiGsMY-URLOpnB8QzbUrx8/edit#gid=0", "Sheet1!I1:I12"))
Make sure you replace the URLs above with the one for the sheet you are trying to pull from
I think you need to use IMPORTRANGE to bring in the columns you want to your active sheet. You can either import the data first and then use a formula in another cell to work with it, or you can use IMPORTRANGE inside your SUMIF formula.
EDIT: Here's a workbook that has it working.
The formula in Sheet1!A1 is =IMPORTRANGE("https://docs.google.com/spreadsheets/d/1L4t2xkmHPAOn8uGT3bFy56UMWrZaHsyq4FlOh6uR2g0/edit?usp=sharing","Sheet1!A1:I12"), which pulls the data from your shared workbook1 into this sheet.
The formula in Sheet2!A2 is =SUMIFS(Sheet1!I2:I12,Sheet1!H2:H12,"1111-1111",Sheet1!B2:B12,"1111")
You could also put the SUMIFS formula on Sheet1 if you prefer. It's 2 steps instead of one, but it works!

How to insert row with formula that links cell? Google Sheets API

The answer is next:
1) There is formula in Google Sheet cell "A11", for example "=F11+C11";
2) I append multiple data to this Google Sheet list with the help of
https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/batchUpdate
or https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append
3) I need to append the value for "A12" using its current position. It had to become "=F12+C12".
Or if I append data on top
(as described here - Google sheets API append method (last on top))
I need that formulas under my append changed to correct value. If current value of "A11" is "=F11+C11" then,
if I add 3 rows before this row, it becomes "A14" cell and it's value had to be changed to "=F14+C14"
Is there any way to realise both this scenarious directly in Google Sheets API request? May be there is some settings in Google Sheet that can help me (something like formating of cells/columns etc)?
UPD. For now it all works fine except of that incident when formula returns exception! My questions is not actual for now, but I still not understand in which cases formulas will change and in which they will not.
The answer is quiet simple!
I update cell 'A13' with formula '=B2+C2' and as cells 'B2' and 'C2' stay on their places after every changes my cell 'A13' still link cells 'B2' and 'C2'.
But if I will add row before 'B2' and/or 'C2' then formula will change and my cell 'A13' will link 'B3' and 'C3'.

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.

Custom Formula Conditional Formatting incorporating 2 spreadsheets

Is it possible to arrange a conditional formatting custom formula based on information input into a different spreadsheet?
For example, I have 1 in A1, 2 in A2 and 3 in A3 on a spreadsheet saved as 'Numbers' and in a worksheet titled 'List' and in a spreadsheet saved as 'Input' I enter 1 in A1 of a worksheet titled 'Entry'. When I enter 1 in the 'Input' spreadsheet I would want cell A1 in the 'Numbers' spreadsheet to become highlighted.
I've had a play around with IMPORTRANGE AND IF formulae but to no avail
try:
=A1=IMPORTRANGE("16nnuzNRx_kGGJm1EBVX7kBT2bfW1-2TYwSiuaLF-Q", "Numbers!A1:A")
that weird number is spreadsheet ID (you can find it in URL between d/ and /edit)
note that both ranges need to be formatted same
a faster alternative would be to use IMORTRANGE to import those values in some column and then just compare those two columns

Resources