# Formula help: How to index one entity in a collection?

**URL:** <https://community.fibery.io/t/formula-help-how-to-index-one-entity-in-a-collection/1817>\
**Category:** Get Help\
**Created:** [July 19, 2021, 3:53pm UTC](https://community.fibery.io/t/formula-help-how-to-index-one-entity-in-a-collection/1817 "2021-07-19T15:53:45Z")\
**Posts on this page:** 1\
**Showing post:** 14

<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:** [September 6, 2024, 12:51pm UTC](https://community.fibery.io/t/formula-help-how-to-index-one-entity-in-a-collection/1817/14 "2024-09-06T12:51:31Z")

</div>

See here:

> [@Formula to assign number based on sorting](https://community.fibery.io/t/formula-to-assign-number-based-on-sorting/3652/5):
>
> I don’t know why it took me so long to figure out a more elegant solution to this, but here is an example of a formula that will tell you the relative position of a Task entity amongst all the Tasks related to a common parent Project: (Find(Project.Tasks.Sort([Start Date]).Join("#" + Right("000" + [Public Id], 4), ""),"#" + Right("000" + [Public Id], 4)) + 4) / 5 In this example, the position is given for items based on their start date, but it can equally be used to get the position of items…

A general formula for getting the index of an entity within a collection:

`(Find(Collection.Entities.Sort([Parameter to sort on]).Join("#" + Right("000" + [Public Id], 4), ""),"#" + Right("000" + [Public Id], 4)) + 4) / 5`

I expect it will slow down the formula service if you have a large collection size though ☹

---

_[View the full topic](https://community.fibery.io/t/formula-help-how-to-index-one-entity-in-a-collection/1817)._
