Skip to main content
Question

Count number of populated fields among a group of 10 numeric fields.

  • Jul 10, 2018 7:18 PM UTC
  • 0 replies
  • 51 views

I have a group of 10 numeric fields, some of them contain data and some don't. I want to count the number of fields which contain data, for example if field 1 contains <3241>, field 2 contains <4567>, field 3 is <empty> resulting total should be 2. I want to make this work in a calculated column so it can be used in reports. 
This topic has been closed for replies.

  • Qrew Corporal
  • Jul 10, 2018 7:22 PM UTC
Count([field1], [field2], [field3])

You can use the count function to count "trues".  There is a question as to how to deal with blanks.  if the fields are NOT set to treat blank as zero (ie to treat them as null)

Count(
not IsNull([Field 1]),
not IsNull([Field 2]),
...
not IsNull([Field 10]))

If they are set to treat blank as zero then

Count(
[Field 1]<>0,
[Field 2]<>0,
...
[Field 10]<>0)

  • Author
  • Qrew Corporal
  • Jul 10, 2018 7:42 PM UTC
Thanks this worked just fine!