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


2 Answers 2


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 ? Oct 7, 2014 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/… Oct 7, 2014 at 10:00
  • Did you notice that I have merged cells in between ? Oct 8, 2014 at 3:02
  • Yes that worked, the problem was I had put two = signs with the formula. Now its solved. Oct 8, 2014 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 agree to our terms of service and acknowledge you have read our privacy policy.

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