1
votes

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?

2

2 Answers

3
votes

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")
0
votes

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