+ Reply to Thread
Results 1 to 4 of 4

Macro to catch cell value

  1. #1
    Registered User
    Join Date
    06-18-2008
    Posts
    4

    Macro to catch cell value

    hi all,
    i have a 2x2 table in excel and i want to count the number of cells that have a specific "value or text" entered by user.

    for below example i want to count the number of cells that have "hi" as a value

    C1 C2
    a hi
    hi b
    c d

    etc....

    is there a way where i can write a handy macro?

    thanks for help,

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: Macro to catch cell value

    why not use the COUNTIF formula?

    =COUNTIF(A1:B2,"hi")
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    06-18-2008
    Posts
    4

    Re: Macro to catch cell value

    Quote Originally Posted by Andy Pope View Post
    why not use the COUNTIF formula?

    =COUNTIF(A1:B2,"hi")
    thanks for response; but what if user enter "5. hi" in a cell then this function may not work properly?

  4. #4
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208

    Re: Macro to catch cell value

    Going off Andy's formula, you can use:

    =COUNTIF(A1:B2,"*hi*")

    HTH,
    Jason

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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