extract URL from another cell to be used in importrange function - google-sheets

I am trying to optimize some spreadsheets I use at work and I have an idea that would save me a good bit of time. I have a formula which extracts a bunch of data from another spreadsheet and organizes it.
What I would like is to have the spreadsheet hyperlinked in cell A2 and then have a formula in B2 which uses importrange while extracting the url from the hyperlinked text in A2. Is this possible?

if A1 is hyperlink / formula try:
=IMPORTRANGE(REGEXEXTRACT(INDEX(SPLIT(FORMULATEXT(A1), " "),,1), """(.*)"""),
"Sheet1!A1")
if A1 is not hyperlinked there were scripts for this but none of them works nowadays
but there is an add-on that can convert non-hyperlinks into hyperlinks:
https://gsuite.google.com/marketplace/app/extract_urls/143780651832

Related

Using a cell's value in a function to fetch data from a different sheet - google sheets

I have two google sheets: sheet1 and sheet2. In sheet1 I have in cell A1 this the text "sheet2!b2". How do I reference A1 in cell A2 to be able to pull the ACTUAL data from sheet2!b2? When I try to use in a formula, i just get the sheet2!b2 text... it does not pull the value from sheet2. Any help would be appreciated. Thank you
As #RemcoE33 said in your comment, you can use the Indirect formula, it takes a string in the formula, so you can reference it as:
Indirect(A1) (as seen in the image below, or
Indirect("Sheet2!B2")
(the value of my sheet2!b2 is Hello, so you can see it works. For more information you have the documentation of Indirect

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!

Conditional Formatting & Importrange using 2 spreadsheets

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)

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

Using a formula to specify sheet in Google Spreadsheets

What I did is pseudocode basically and I just want to specify the sheet using a cell as shown in the picture. What is the proper notation (if there is any)?
(Trying to solve E3 in this example. It should show a number from another sheet, and I just want to make it easy to copy/paste down column E by referencing to the sheets using the strings in column A)
You can use INDIRECT() function to do that, for example :
=INDIRECT(A3 & "!B4")
You may need to wrap sheet name with quotes if it contains special character(s) :
=INDIRECT("'" & A3 & "'!B4")

Resources