5 Replies Latest reply on Mar 23, 2009 4:35 PM by philmodjunk

# Calculate the number of occurrences of specific text value over several fields

### Title

Calculate the number of occurrences of specific text value over several fields

### Post

Hello,

I'm using Filemaker Pro 9.

I have a table that has the names of up to four different people (each person entered in a separate field). Next to each name I have a set of radio buttons to select gender, Male or Female (M or F).

I need two fields at the bottom, one calculating the total number of  males (M) on the form, and one calculating the total number of Females (F).

I am so far unable to find a way of doing this efficiently.

Can anyone help?

thanks

• ###### 1. Re: Calculate the number of occurrences of specific text value over several fields

Hi Sunjar and welcome to the forum.

To total up all the Ms and Fs for that particular record try these calculations, Assuming your gender fields are numbered 1 through 5:

CountMale ( Calculated Number )

If ( Gender1 = "M" ; 1 ) +
If ( Gender2 = "M" ; 1 ) +
If ( Gender3 = "M" ; 1 ) +
If ( Gender4 = "M" ; 1 )

and

CountFemale ( Calculated Number )

If ( Gender1 = "F" ; 1 ) +
If ( Gender2 = "F" ; 1 ) +
If ( Gender3 = "F" ; 1 ) +
If ( Gender4 = "F" ; 1 )

I hope this helps

• ###### 2. Re: Calculate the number of occurrences of specific text value over several fields

Too easy!!!

works great, Thanks!

cheers

• ###### 3. Re: Calculate the number of occurrences of specific text value over several fields

sunjar wrote:

I have a table that has the names of up to four different people (each person entered in a separate field).

This is not a good arrangement. You should have a separate related table for the people, with individual records for each. A lot of things will become easier that way.

• ###### 4. Re: Calculate the number of occurrences of specific text value over several fields

Yes. This is something I argued hard with my client about. I am importing records from an Acrobat PDF form (csv file). And despite my best arguments, this was the way the form needed to be set up (that is, with up to four people on each). Apparently people are happier to book a group with their friends if they are on the same form.

If you know an easy way of separating the extra people from an imported csv file that would certainly make things easier.

(I realise that importing the file several times, importing the person 2, 3 and 4 into the separate table would work, but that is long and cumbersome.)

If you have any suggestions I would certainly appreciate them.

• ###### 5. Re: Calculate the number of occurrences of specific text value over several fields