I have three categories: Masters 2020, Masters 2021, and Masters 2022.
They have figures in them, but instead of getting the total, I am trying to count them. That is, I am treating each figure as 1, even though its value is something else. I know that in the Analyze field they have a way to count it, would like to count the figures in each field.
Could you provide an example of the content you are looking at and the result you want to achieve. For example, if you have a field that has “figures” in it - like 3756, and you are, “treating each figure as 1”, then if you want to count the figures - actually, the number of figures - in the field it would be 4 - correct?
So, if the field just had figures in it - an assumption because we don’t have an example of the data - wouldn’t you just need to get the length of the field (using a function to covert it to text - if it’s a numeric field - embedded in the length function)?
The function below assumes there is no negative signs that would add to the character count. If there are, you could always add an absolute value, abs(), function to remove it before doing the str().
First, to be sure I understand your question, is it the case that the first field might contain 95, 42, and 77, while the second field contained 68, 88, 64, and18? In that case, and assuming that the fields are text fields, the formula wordcount(A)gives me 3 for the first field and 4 for the second. (The entries are separated by carriage returns. It also works if the entries are separated by spaces, though not if they are separated just by commas. It seems to be counting spaces, and the commas are ignored or counted as part of the preceding word. There’s no parameter for a separator. Also, if I separate the entries with more than one space character, the extra spaces are ignored.) I can’t make @epansoft’s suggestion work, though I may well be missing something.
What do you mean by a “category”? That is not a term that Panorama uses.
Some of the replies here are assuming that by “categories” you are referring to fields, but I am not so sure. It’s basically impossible to provide useful assistance without any understanding of what you are asking.
Ok, maybe this chart will help. When I said categories, I meant fields.
In this chart, I want to add up these fields circled in Red:
2020 Rds
2021 Rds
2022 Rds
2023 Rds
2024 Rds
And I want the Events Played field circled in blue to count those five fields. I want to avoid having to enter fields 2020 Playing that I have put a 1 in and add up.
Hopefully there is a formula to count fields?
I guess you are saying that if one of these fields has zero in it that you want it to count as zero, but if it has any other number you want to count it as one? If I am understanding this correctly then you can easily do this.
Examples are better than “language”. It doesn’t seem so much that you want to “add up” those fields as you want to have a count, per row, of the number for those five NUMERIC fields that have non-zero content.
So you could put Jim formula in a FormulaFill for Field EventsPlayed.
You would get there via the Morph tool or Select Morph under the field menu.
Here’s what the entry would look like. Note that I changed the field names, putting rd first, so I didn’t have to use chevrons. As Jim showed, you will need to use chevrons with your field names.
Field EventsPlayed
FormulaFill min(1,«2020Rds»)+min(1,«2021Rds»)+min(1,«2022Rds»)+min(1,«2023Rds»)+min(1,«2024Rds»)
This what it’s doing … the min() function will return 1 if the value of the Rds field is 1 or greater. If there is nothing in the Rd field, the min() function will return 0 (zero). The FormulaFill will apply that to all selected records. The field you moved to - before the formulafill - EventsPlayed, will hold the count of the number for “Rd” fields that have non-zero content.