+ Reply to Thread
Results 1 to 6 of 6

Count number of times a word occurs on a sheet

  1. #1
    Registered User
    Join Date
    10-10-2003
    Location
    Massachusetts
    MS-Off Ver
    Office 365
    Posts
    88

    Count number of times a word occurs on a sheet

    We would like to create a form that allows us to count the number of times a word occurs on a sheet.

    The form itself would be very basic Just two fields necessary. One to input the woed of interest, and one to display how many times that word occurs on the current sheet.

    A text field (lets call it txtTest)
    A label or text box ( call it lblCount or txtCount)
    We would like to be able to enter the name of one of the analyses we perform, "HAA" for instance in the txtTest field, and have the txtCount of lblCount field show the number of times the value in the txtTest field occurs on the entire sheet.

    I've tried to copy and paste several examples found online into a cell, all to no avail.
    As always, any help is greatly appreciated.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Count number of times a word occurs on a sheet

    Why do you need to use a macro? This can be done with a simple formula.

    Assuming that your data is in Sheet1.
    Create a new sheet.
    In A1, place the word that you want to count.
    In A2, put this formula:

    =COUNTIF(Sheet1!A1:Z99,"*" & A1 & "*")

    where Z99 is the lower-right corner of your data.

    It would also help to provide a file with a sample of your data. See yellow banner at the top.

  3. #3
    Registered User
    Join Date
    10-10-2003
    Location
    Massachusetts
    MS-Off Ver
    Office 365
    Posts
    88

    Re: Count number of times a word occurs on a sheet

    That works for text values. Not getting correct count for numerical values.
    Example sheet id attached.
    Attached Files Attached Files

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Count number of times a word occurs on a sheet

    Your example was text; you didn't mention there were numbers. If you are matching exactly the entire cell, rather than just looking for a part of a cell, it's even easier.

    =COUNTIF(Sheet1!A1:B20,A1)
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    10-10-2003
    Location
    Massachusetts
    MS-Off Ver
    Office 365
    Posts
    88

    Re: Count number of times a word occurs on a sheet

    Perfect. Sorry for not being more clear initially. THANKYOU.

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Count number of times a word occurs on a sheet

    You're welcome! Just come back if for some reason you really need a macro solution.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. I need to count the number of times an action occurs.
    By apmgold in forum Excel General
    Replies: 3
    Last Post: 03-30-2020, 11:19 AM
  2. [SOLVED] Count the number of times each date occurs
    By Shahbazk in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-07-2017, 09:14 AM
  3. displaying number of times a word occurs in a table column with VBA
    By kor123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-10-2016, 06:20 AM
  4. Count the number of consecutive times a value occurs
    By mbhc77 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-09-2014, 07:58 AM
  5. [SOLVED] Count how many times a word occurs in a cell containing text
    By frisbie17 in forum Excel General
    Replies: 2
    Last Post: 08-01-2012, 02:31 PM
  6. [SOLVED] How to count the number of times something occurs within a certain month
    By Joyce in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-18-2005, 02:05 PM
  7. [SOLVED] Macro to Count how many times a number occurs on a day
    By SirMetro in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-02-2005, 02:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1