5
\$\begingroup\$

Step one

In a new google sheet insert an image into cell A1 with

Insert > Image > Image In Cell

Step two

Create a formula to return TRUE (if the cell contains an image) and FALSE (if the image is missing)

Rules

Only vanilla formulas are allowed. The shortest code in bytes wins.

\$\endgroup\$
6
  • 2
    \$\begingroup\$ Welcome to Code Golf! Your first question is OK, however it is never a good idea to post a super short answer to your own question immediately; you could, however, post it as a comment on your challenge and give brownie points to anyone who beats it. Next, answers should be scored by bytes, not characters. Finally, text-processing isn't relevant to this challenge. I recommend you read How to Ask a Good Question before asking questions and try posting competitive answers too. \$\endgroup\$ – Makonede Apr 2 at 22:23
  • 4
    \$\begingroup\$ As a challenge, this is completely fine. I'd consider making this a tips question, honestly, but it's not a bad challenge. \$\endgroup\$ – hyper-neutrino Apr 2 at 22:24
  • \$\begingroup\$ Will excel formulas and VBA be ok? \$\endgroup\$ – Wasif Apr 3 at 2:13
  • \$\begingroup\$ Is the cell empty if the image is not there, or might it contain other non-image content? \$\endgroup\$ – xnor Apr 3 at 6:23
  • \$\begingroup\$ @Wasif This question is google sheets only since I do not believe excel allows images inside cells like google sheets, at least exporting the google sheet to excel pushes the image outside of the cell. \$\endgroup\$ – CodeCamper Apr 4 at 3:38
3
\$\begingroup\$

26

The shortest I've found, which I believe currently works, is:

=TYPE(A1)>64>ISFORMULA(A1)
\$\endgroup\$
1
\$\begingroup\$
=ISERR(A1&"")

13 characters, have not yet verified any false positives as I believe everything can be concatenated except images.

EDIT: False positive confirmed in comments from division error for example as these cannot be concatenated either.

\$\endgroup\$
1
  • 6
    \$\begingroup\$ Typing =1/0 into A1 will also give an error here (as in, false positive). \$\endgroup\$ – hyper-neutrino Apr 2 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.