Forum Discussion

RyanRyan3's avatar
RyanRyan3
Qrew Member
10 years ago

How to use a formula field to count number of users selected in a list user field?

I'm trying to figure out if there is a way to count the number of users in a list user field to help calculate and determine a projected completion date based on the number of user assigned to a tasks and the total number of hours estimated for a job.

4 Replies

  • This is working for me--just replace [User List] with the field in question, and you'll need to add conditions for 6-10.

    If(

    not IsNull(ToUser(Part(ToText([User List]),5,";"))), 5,

    not IsNull(ToUser(Part(ToText([User List]),4,";"))), 4,

    not IsNull(ToUser(Part(ToText([User List]),3,";"))), 3,

    not IsNull(ToUser(Part(ToText([User List]),2,";"))), 2,

    not IsNull(ToUser(Part(ToText([User List]),1,";"))), 1

    )
  • Also this formula would work, replace

      with the name of your list user field

    var UserList myUserList =

      ;
      var Text users = SearchAndReplace(SearchAndReplace(Trim(ToText($myUserList))," ;", ";"),"; ",";");
      Count(
      Part($users,1,";"),
      Part($users,2,";"),
      Part($users,3,";"),
      Part($users,4,";"),
      Part($users,5,";"),
      Part($users,6,";"),
      Part($users,7,";"),
      Part($users,8,";"),
      Part($users,9,";"),
      Part($users,10,";"),
      Part($users,11,";"),
      Part($users,12,";"),
      Part($users,13,";"),
      Part($users,14,";"),
      Part($users,15,";"),
      Part($users,16,";"),
      Part($users,17,";"),
      Part($users,18,";"),
      Part($users,19,";"),
      Part($users,20,";")
      )