Google Spreadsheets supports an IMAGE
function to include a graphic inside a cell. If the URL provided does not yield a valid picture resource, e.g. the server returns a 404
response, the cell will look empty and not throw any #
error. Alas, neither of COUNT
, COUNTA
, COUNTBLANK
and COUNTUNIQUE
treats these visually empty cells any different than those that successfully show an image (and neither do the respective IS...
functions). There also seems to be no respective expression that one could supply as a second parameter to COUNTIF
(S
).
Is there any way to count all cells of a region that either contain or do not contain an image? If not, should this be considered a bug and be reported accordingly? Where?
Best Answer
The following piece of code will try and fetch an URL. If possible (200) then 1, else 0 (404 or else).
Code
Screenshot
Note
Paste this code into the script editor (Tools > Script editor...) and press the bug button to authenticate the script. After that, you are able the use the custom formula.