Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
If I have some text in a cell, how can I find the number of times another piece of text appears in it? For example, suppose A1 contains Peter Piper picked a peck of pickled peppers.. pick occurs 2...
#11: Post edited
- If I have some text in a cell, how can I find the number of times another piece of text appears in it?
For example, suppose `A1` contains `fuzzy wuzzy was a bear`. `zz` occurs 2 times in this string. What formula can I put in `A2` so that it counts the occurrences of `zz` and returns 2?
- If I have some text in a cell, how can I find the number of times another piece of text appears in it?
- For example, suppose `A1` contains `Peter Piper picked a peck of pickled peppers.`. `pick` occurs 2 times in this string. What formula can I put in `A2` so that it counts the occurrences of `pick` and returns 2?
#10: Post edited
Count the number of occurrences in a text string
The question about [LibreOffice Calc - Number of occurrences in text string](https://stackoverflow.com/questions/63746604/libreoffice-calc-number-of-occurrences-in-text-string) from [Binz Nakama](https://stackoverflow.com/users/3483815/binz-nakama) at Stack Overflow interested me because of one of the comments posted there:>OK, I think this would require a macro, AFAIK there's no single formula or combination to achieve this.The Comment was from tohuwawohu, the user currently standing at top of the All Time list of Answerers for [libreoffice-calc], the tag applied to the Q.The essence of the Q was:>I'm looking for a formula or combination thereof that can count the number of occurrences/repetitions in a text string.Examples provided in the Q were:>if cell A1 contains "XYZXYZ", I would like to search cell A1 for "XYZ" and have "2" as a resultand, for *If B1 contains "Mary is my friend but Mary doesn't like roses"*:>={find.repetitions}(B1;"Mary") --> 2<sub>Aside: "Tags must have at least one tag" is odd.</sub>
- If I have some text in a cell, how can I find the number of times another piece of text appears in it?
- For example, suppose `A1` contains `fuzzy wuzzy was a bear`. `zz` occurs 2 times in this string. What formula can I put in `A2` so that it counts the occurrences of `zz` and returns 2?
#9: Post edited
Count the number of occurrences in a text string
The question about [LibreOffice Calc - Number of occurrences in text string](https://stackoverflow.com/questions/63746604/libreoffice-calc-number-of-occurrences-in-text-string) from [Binz Nakama](https://stackoverflow.com/users/3483815/binz-nakama) at Stack Overflow interested me because of one of the comments posted there: >OK, I think this would require a macro, AFAIK there's no single formula or combination to achieve this. The Comment was from tohuwawohu, the user currently standing at top of the All Time list of Answerers for [libreoffice-calc], the tag applied to the Q. The essence of the Q was: >I'm looking for a formula or combination thereof that can count the number of occurrences/repetitions in a text string. Examples provided in the Q were: >if cell A1 contains "XYZXYZ", I would like to search cell A1 for "XYZ" and have "2" as a result and, for *If B1 contains "Mary is my friend but Mary doesn't like roses"*: >={find.repetitions}(B1;"Mary") --> 2 <sub>Aside: "Tags must have at least one tag" is odd.</sub>
#6: Post edited
This [Q](https://stackoverflow.com/questions/63746604/libreoffice-calc-number-of-occurrences-in-text-string) from Binz Nakama at Stack Overflow interested me because of the Comment there:>OK, i think this would require a macro, AFAIK there's no single formula or combination to achieve this.The Comment was from tohuwawohu, the user currently standing top of the All Time list of Answerers for [libreoffice-calc], the tag applied to the Q.- The essence of the Q was:
- >I'm looking for a formula or combination thereof that can count the number of occurrences/repetitions in a text string.
- Examples provided in the Q were:
- >if cell A1 contains "XYZXYZ", I would like to search cell A1 for "XYZ" and have "2" as a result
- and, for *If B1 contains "Mary is my friend but Mary doesn't like roses"*:
- >={find.repetitions}(B1;"Mary") --> 2
- <sub>Aside: "Tags must have at least one tag" is odd.</sub>
- The question about [LibreOffice Calc - Number of occurrences in text string](https://stackoverflow.com/questions/63746604/libreoffice-calc-number-of-occurrences-in-text-string) from [Binz Nakama](https://stackoverflow.com/users/3483815/binz-nakama) at Stack Overflow interested me because of one of the comments posted there:
- >OK, I think this would require a macro, AFAIK there's no single formula or combination to achieve this.
- The Comment was from tohuwawohu, the user currently standing at top of the All Time list of Answerers for [libreoffice-calc], the tag applied to the Q.
- The essence of the Q was:
- >I'm looking for a formula or combination thereof that can count the number of occurrences/repetitions in a text string.
- Examples provided in the Q were:
- >if cell A1 contains "XYZXYZ", I would like to search cell A1 for "XYZ" and have "2" as a result
- and, for *If B1 contains "Mary is my friend but Mary doesn't like roses"*:
- >={find.repetitions}(B1;"Mary") --> 2
- <sub>Aside: "Tags must have at least one tag" is odd.</sub>
#3: Post edited
- This [Q](https://stackoverflow.com/questions/63746604/libreoffice-calc-number-of-occurrences-in-text-string) from Binz Nakama at Stack Overflow interested me because of the Comment there:
- >OK, i think this would require a macro, AFAIK there's no single formula or combination to achieve this.
- The Comment was from tohuwawohu, the user currently standing top of the All Time list of Answerers for [libreoffice-calc], the tag applied to the Q.
- The essence of the Q was:
- >I'm looking for a formula or combination thereof that can count the number of occurrences/repetitions in a text string.
- Examples provided in the Q were:
- >if cell A1 contains "XYZXYZ", I would like to search cell A1 for "XYZ" and have "2" as a result
and, for "If B1 contains "Mary is my friend but Mary doesn't like roses":- >={find.repetitions}(B1;"Mary") --> 2
- <sub>Aside: "Tags must have at least one tag" is odd.</sub>
- This [Q](https://stackoverflow.com/questions/63746604/libreoffice-calc-number-of-occurrences-in-text-string) from Binz Nakama at Stack Overflow interested me because of the Comment there:
- >OK, i think this would require a macro, AFAIK there's no single formula or combination to achieve this.
- The Comment was from tohuwawohu, the user currently standing top of the All Time list of Answerers for [libreoffice-calc], the tag applied to the Q.
- The essence of the Q was:
- >I'm looking for a formula or combination thereof that can count the number of occurrences/repetitions in a text string.
- Examples provided in the Q were:
- >if cell A1 contains "XYZXYZ", I would like to search cell A1 for "XYZ" and have "2" as a result
- and, for *If B1 contains "Mary is my friend but Mary doesn't like roses"*:
- >={find.repetitions}(B1;"Mary") --> 2
- <sub>Aside: "Tags must have at least one tag" is odd.</sub>
#1: Initial revision
Count the number of occurrences in a text string
This [Q](https://stackoverflow.com/questions/63746604/libreoffice-calc-number-of-occurrences-in-text-string) from Binz Nakama at Stack Overflow interested me because of the Comment there: >OK, i think this would require a macro, AFAIK there's no single formula or combination to achieve this. The Comment was from tohuwawohu, the user currently standing top of the All Time list of Answerers for [libreoffice-calc], the tag applied to the Q. The essence of the Q was: >I'm looking for a formula or combination thereof that can count the number of occurrences/repetitions in a text string. Examples provided in the Q were: >if cell A1 contains "XYZXYZ", I would like to search cell A1 for "XYZ" and have "2" as a result and, for "If B1 contains "Mary is my friend but Mary doesn't like roses": >={find.repetitions}(B1;"Mary") --> 2 <sub>Aside: "Tags must have at least one tag" is odd.</sub>