Forum Discussion

MathildaBackman's avatar
1 year ago
Solved

Count e-mail addresses

I have a table that contains different SharePoint sites.
I have a column called Group.Owners where I have the e-mail address to the owner/owners of that site.
There can be none, one or multiple e-mail addresses in that column. And there are of course different values on each row.
The e-mail addresses all have @ and if there are more than one, they are separeted by a semicolon. 
Like this: [email protected]; [email protected]; [email protected]

I want to, in the easiest way, count the number of e-mailaddresses on each row.
I thought the easiest way was to count how many times @ appears in that column on each row. But I cant figure out how to do this.

I need help! 

  • ZhangKun's avatar
    ZhangKun
    1 year ago

    Because some cell is null in Group.Owners column, you can use following code:

    List.Count(Text.PositionOf([Group.Owners] ?? "", "@", Occurrence.All))

     

6 Replies

  • Add a custom column,use following code:

    List.Count(Text.PositionOf([Group.Owners], "@", Occurrence.All))

     

     

    • MathildaBackman's avatar
      MathildaBackman
      Helper I

      Oh, great solution, but I get this error:

      Expression.Error: We cannot convert the value null to type Text.
      Details:
          Value=
          Type=[Type]

      • ZhangKun's avatar
        ZhangKun
        Super User

        Because some cell is null in Group.Owners column, you can use following code:

        List.Count(Text.PositionOf([Group.Owners] ?? "", "@", Occurrence.All))