COUNTIF and IMPORTRANGE returning 0 - google-sheets

I would like to use the COUNTIF and IMPORTRANGE functions in Google Sheets, but the results keep returning 0. Here's my formula:
=COUNTIF(IMPORTRANGE("sheet key","PDFs!A2:A13"), "Yes")
There are no permission restrictions on the sheet I am trying to query, though I might restrict it to specific people.
I've tried the formula using the key and the sheet URL.
I've tested the formula with a tab in the same sheet and it works. Here is the formula I used:
=COUNTIF(PDFs!A2:A13,"Yes")
Any thoughts on why the COUNTIF/IMPORTRANGE formula isn't working?
Would restricting permissions make the formula not work?

Yes, specific authorisation is necessary and no, you don't need the sheet name as well as the key.
Try just:
=IMPORTRANGE("sheet key","A2:A13")
which should ask you for authorisation (if required) and grant it (if necessary). Then replace above with:
=COUNTIF(IMPORTRANGE("sheet key","A2:A13"),"Yes")

First use core Importrange formula Importrange("Key","Sheet!A2") and allow access. Once sheet gets the access then apply the whole formula, i.e countif(importrange("key","Sheet!A2:A),"Yes")

Related

my =Importrange Formula on Google sheet doesn't work with multiple Xlookups in the sheet

I'm making a budget sheet on google sheets. When I use importrange on my google sheet, it works perfectly fine. However when I use an Xlookup in a different tab and different cell, the Importrange fails and gets stuck on loading. I'm not sure why... It may be because they loosely reference each other? I'm using Xlookups to sum a range which includes some of the imported data... But in my mind, that shouldn't affect the Importrange at all. If you delete all the xlookups, the importrange pushes through, and if there is only 1 Xlookup in the entire sheet, Importrange still works... Can anyone help??? I've linked the sheet below so that you can play with it. You can change the links for the importrange freely.
FYI you have to delete the importrange / refresh the page after each change as the importrange will just keep the data their until there is a change on either the data side or sheet side.
Link to the Sheet
I tried deleting all Xlookups and and changing the Importange Range to lessen the impact
I tried array constraining other formulas in the sheet because I thought it was stuck on too many calculations
I tried simplifying the Xlookup formulas to set ranges.
you can build your IMPORTRANGE like:
=ARRAYFORMULA(IFERROR(NOW()/0)&IMPORTRANGE(D2; "A1:A4"))
and with:
changes won't be instant of course but they will flow more often

Very Specific Filtering in Google Sheets

I am making a calculator in Google sheets and I would like to find a formula or script or something that will allow me to read the value of a certain square and add the formula "=sum(C5:C9)" or "=product(C5:C9)" or whichever depending on what the person puts in C4. Not sure if this is possible in google sheets (without custom code), but if it is, that would be great!
try:
=IF(C4="*"; PRODUCT(C5:C9); SUM(C5:C9))

Google sheets, vlookup, iferror formula in a script as a function

I have the below formula that populates data from another sheet into one of the columns.
The problem is that I have to allow access between the sheets for the below to work. Unfortunately with the IFERROR statement I don't see the "Allow access to the sheet" popup.
So i have to remove IFERROR and re-add it manually each time.
Is there a way to use vlookup without IFERROR?
Or could I put this formula as a function using the script ?
=ARRAYFORMULA(LOWER(IFERROR(IF(C1:C="test",VLOOKUP(A1:A,IMPORTRANGE("sheet_id","Master !L:N"),3,false),hosts!L3:L))))
many thanks
That is NOT the problem with your formula. (actually it seems to work just fine)
The way the IMPORTRANGE function works is that you only have to "Allow access ONCE.
Once access is granted you don't have to do it again. The two sheets are connected for eternity :)
Tip:
Instead of trying to grand access from inside your formula, try the following
On another cell (any empty cell will do) use just the IMPORTRANGE formula:
=IMPORTRANGE("sheet_id","Master !L:N")
You will be asked to give access. Allow it.
Now the sheets are connected and your formula works as expected.

Editable vlookup value returned?

I have two pages of spreadsheets in Google Sheets. Sheet1 and Sheet2.
I have a Vlookup function in Sheet2 that returning me the value in sheet1.
I would like to know if there is a way to edit this returned value in sheet2 and this value entered in sheet2 be updated in sheet1.
If I try to do that now, it only changes the vlookup formula.
No, this is simply not possible.
Data can be displayed in many places, or used in many formulas, but if it is "just" a value in a cell, it must have one canonical source.
If this is a serious requirement for your project, consider using a database rather than a spreadsheet. Or research whether or not this sort of dual-direction flow is feasible and advisable via Google Apps Script. Both of those are serious undertakings though, and almost certainly overkill.

How to show duplicates on 2 google sheets at the same time?

This conditional format command shows duplictes on the Sheet1 perfectly:
Appliy to range A:A
=COUNTIF(A:A,A1)>1
Is it possible make it work with Sheet2 at the same time. I've read that INDIRECT could help but I don't understand how to do that.
I tried this with no luck:
If you want it to check both sheets for duplicates, you can still use almost the same formula, but you have to put the references into an Indirect statement:
=countif(INDIRECT("Sheet1!A:A"),A1)+countif(INDIRECT("Sheet2!A:A"),A1)>1
as mentioned in the documentation

Resources