In Excel, how to Count the number of times words appear in adjacent columns

Barbara Hippe 60 Reputation points
2026-08-09T12:27:50.9666667+00:00

I have over a thousand rows, 3 columns, of many keywords associated with types of books.

I want to Excel to first identify each discrete keyword and count how many times it appears in those 1000+ records

business reference economics

fiction popular mystery

children set fiction

history american popular

Microsoft 365 and Office | Excel | For home | Windows
0 comments No comments

Answer accepted by question author
Barry Schwarz 6,106 Reputation points
2026-08-12T00:40:35.9333333+00:00

My testing was able to produce a SUMIF problem that appears to match yours. I don't know what causes it or how consistent it is. It appears that SUMIF did not recognize a match when the value being tested against the criteria is not in the first column of the range. The value "Best Seller" in F:H that should match U1284 is in G or H but not in F. This results in a sum of 0 and your accounting format causes that to display as a dash.

The following workaround appears to produce the desired result:

=SUM(IF((--($F$6:$F$1537=U1280))+(--($G$6:$G$1537=U1280))+(--($H$6:$H$1537=U1280)),$E$6:$E$1537,0))

This goes in W1280 and gets copied down till the last key word in column U.

If you put it in column X instead, you may discover some of the values in W are incorrect but don't catch the eye the way the dash did.

Was this answer helpful?

1 person found this answer helpful.

Answer accepted by question author
Ashish Mathur 102.4K Reputation points Volunteer Moderator
2026-08-09T23:07:20.14+00:00

Hi,

In cell F2, enter this formula

=LET(a,TOCOL(A2:C7,1),GROUPBY(a,a,COUNTA,,0))

Hope this helps.

User's image

Was this answer helpful?

1 person found this answer helpful.

Answer accepted by question author
riny 21,520 Reputation points Volunteer Moderator
2026-08-09T13:35:40.36+00:00

@Barbara Hippe

Assuming you have a modern Excel version at your disposal!

User's image

The picture shows the formula in F1. then in G1 I use:

=COUNTIF(A1:C4,F1#)

Is that what you had in mind?

Was this answer helpful?

1 person found this answer helpful.

1 additional answer

Sort by: Oldest
  1. Marcin Policht 107.5K Reputation points MVP Volunteer Moderator
    2026-08-09T13:34:24.8866667+00:00

    If your 3 columns contain multiple keywords separated by spaces, you can have Excel identify every distinct keyword across all 1,000+ rows and count how many times each keyword appears.

    Assuming your data is in A2:C1001, enter this formula in an empty cell:

    =LET(x,TEXTSPLIT(TEXTJOIN(" ",TRUE,A2:C1001)," "),u,UNIQUE(x),HSTACK(u,COUNTIF(x,u)))
    

    Excel will return two columns: the unique keyword and its total count across all three columns and all rows. For example, if “fiction” appears 150 times anywhere in the three columns, the result will show “fiction” and “150”.

    This should work when each keyword is separated by a space, such as “business reference economics” or “fiction popular mystery”. If your actual cells contain keywords separated by commas, semicolons, or another delimiter, the formula needs to be adjusted to that delimiter.


    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.