Share via

What formula do I use

Anonymous
2024-08-23T08:11:38+00:00

I need help with an Excel formula. If I create a cell in a worksheet that has several different animal names, how do I create a formula to count the number of times one specific animal is listed. Each species I type occurs on its own line within the cell as I use Alt "enter" to create individual lines within the cell. The following is a sample of a section of my spreadsheet. Below this I have all the different possible species listed in their individual rows and I want to insert a formula that will return a value of how many times Impala occurs on any one day as an example.

21 22 23
Duiker
Scrub Hare
Duiker Impala
Impala Elephant
Impala
Duiker <br>Dwarf Mongoose Elephant
Duiker
Duiker <br>Impala
Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Ashish Mathur 102K Reputation points Volunteer Moderator
    2024-08-24T00:03:20+00:00

    Hi,

    What answer are you expecting for when you type Duiker?

    Was this answer helpful?

    0 comments No comments
  2. HansV 462.6K Reputation points
    2024-08-23T08:19:32+00:00

    You can use a formula such as

    =SUM(LEN(range)-LEN(SUBSTITUTE(range, animal, "")))/LEN(animal)

    For example, with animals listed in A4:A12, and the specific animal you want to count in K2:

    =SUM(LEN(A4:A12)-LEN(SUBSTITUTE(A4:A12, K2, "")))/LEN(K2)

    Was this answer helpful?

    0 comments No comments