# Formula to count checkboxes in description

**URL:** <https://community.fibery.io/t/formula-to-count-checkboxes-in-description/5926>\
**Category:** Get Help\
**Created:** [March 1, 2024, 7:43pm UTC](https://community.fibery.io/t/formula-to-count-checkboxes-in-description/5926 "2024-03-01T19:43:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Dejaegher](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/ryan_dejaegher/32/8050_2.png) [@Ryan\_Dejaegher](https://community.fibery.io/u/Ryan_Dejaegher)\
**Post date:** [March 1, 2024, 7:43pm UTC](https://community.fibery.io/t/formula-to-count-checkboxes-in-description/5926/1 "2024-03-01T19:43:57Z")

</div>

Hi all, for some projects I don’t need the full scope of project/task database and sometimes use the simple checkboxes directly in the description. However it can be difficult to know what entities contain these checkboxes.

Is anyone aware of a formula that could find/count complete/incomplete checkboxes that are in Descriptions/Rich Text fields?

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [March 4, 2024, 1:25pm UTC](https://community.fibery.io/t/formula-to-count-checkboxes-in-description/5926/2 "2024-03-04T13:25:41Z")

</div>

I don’t think it’s possible with formulas I’m afraid.  
However, you can use an automation to calculate how many ticked/unticked checkboxes there are (and put the result in some fields of your choice):

```auto
const fibery = context.getService('fibery');

for (const entity of args.currentEntities) {
    const content = await fibery.getDocumentContent(entity['Description']['Secret'], 'md');
    const tickedregex = /- \[x\]/g
    const ticked = content.match(tickedregex);
    const untickedregex = /- \[\]/g
    const unticked = content.match(untickedregex);
    await fibery.updateEntity(entity.type, entity.id, { 'Ticked': ticked.length, 'Unticked': unticked.length });
}

```

This looks in the Description field and puts the counts of ticked/unticked as values in the ‘Ticked’ and ‘Unticked’ number fields.

You could have this run as an automation that triggers whenever there is an update to the Description field.

---

<div class="post-metadata">

**Author:** ![Mircea\_Braescu](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/mircea_braescu/32/9729_2.png) [@Mircea\_Braescu](https://community.fibery.io/u/Mircea_Braescu)\
**Post date:** [September 12, 2024, 12:30pm UTC](https://community.fibery.io/t/formula-to-count-checkboxes-in-description/5926/3 "2024-09-12T12:30:23Z")

</div>

We have a similar situation. I updated the fields names to match our use case and the script worked like an absolute charm. Thanks a lot
