Count specific words


#1

Hello,
Is it possible to count the number of specific words in a list?
For example: I have a list
Apple, apple, banana, apple, banana, melon
The output is
Apple=3
Banana=2
Melon=1

Unfortunately, I have not found a tutorial for this.
Does anyone have a tip for me?

Kind regards
Thomas


#2

Well, there are probably 100 different ways to do this, but to help you out, here’s just one so you can play around with it. :sunglasses:

I show how to do the counting via two lists and then how to display the data into two more ListViews. I also show how to combine the two lists into one Textbox. There are other ways, but this should get you going in the right direction.

(Note: Using two “matched” lists, allows you to only have to track one index number. Just use the same index number for both lists and you can’t go wrong.)

Word_Counting.aia (4.9 KB)


#3

This can be another way. I used TitleCase because the lists are sensitive case and RemoveDuplicate to smooth the code

testWord.aia (18.1 KB)


#4

Thanks to both of you! I will test it as soon as I get back to my laptop.

Kind regards
Thomas


#5

One more time: Thanks for the help.
I think the variant of Marco2 is a bit simpler.
At the moment I’m still trying to sort the items by size … but …:rofl:
I have a lot to learn!!

Kind regards,
Thomas