I am very beginner to Google scripting. Here I need to count the number of times the word "FREE" occurred in my sheet. But my function returns me an error

Error: Circular dependency detected**

(See the attached screen shot.)

What am I doing wrong and how can I fix it?

Please note: I have some merged cells here.

enter image description here

up vote 2 down vote accepted

This is happening because you have put the formula inside the range (A1:c6) that you are trying to count the number of "free"'s in.

Put the formula into a cell outside the range.

  • Now I am getting Formula parse error!. Is there any errors in my formula ? – Uvais Ibrahim Oct 7 '14 at 5:08
  • I cannot see one from what you have posted - but it's hard to tell with a picture. But I have just confirmed that =countif(A8:C12, "Free") should work. See here for an example: docs.google.com/spreadsheets/d/… – MaryC.fromNZ Oct 7 '14 at 10:00
  • Did you notice that I have merged cells in between ? – Uvais Ibrahim Oct 8 '14 at 3:02
  • Yes that worked, the problem was I had put two = signs with the formula. Now its solved. – Uvais Ibrahim Oct 8 '14 at 3:06

The formula in cell B5 (the up-left cell in the B5:C6 merged range) should be =COUNTIF(A1:C4).

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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