+ Reply to Thread
Results 1 to 11 of 11

VBA code for countif to look for a specific words

  1. #1
    Registered User
    Join Date
    10-11-2016
    Location
    greece
    MS-Off Ver
    2007
    Posts
    5

    VBA code for countif to look for a specific words

    Hello everyone,

    Here is my issue :
    I want to use this =COUNTIF(Clients!B4:B500,"**") formula on Column C but inside the ** i want it to automatically get the word thats on column A.
    Anyone has any suggestions??


    Thanks in advance.

  2. #2
    Valued Forum Contributor meabrams's Avatar
    Join Date
    10-03-2014
    Location
    USA
    MS-Off Ver
    2007, 2010, 2013, 2016
    Posts
    451

    Re: VBA code for countif to look for a specific words

    Like this?

    Please Login or Register  to view this content.
    Bramz

  3. #3
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: VBA code for countif to look for a specific words

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: VBA code for countif to look for a specific words

    Quote Originally Posted by meabrams View Post
    Like this?

    Please Login or Register  to view this content.
    That will only return exact matches. I think the OP wants partial matches included in the count.

  5. #5
    Valued Forum Contributor meabrams's Avatar
    Join Date
    10-03-2014
    Location
    USA
    MS-Off Ver
    2007, 2010, 2013, 2016
    Posts
    451

    Re: VBA code for countif to look for a specific words

    Wow cant believe I missed the whole propose of what you needed thanks Olly for fixing it

  6. #6
    Registered User
    Join Date
    10-11-2016
    Location
    greece
    MS-Off Ver
    2007
    Posts
    5

    Re: VBA code for countif to look for a specific words

    Thanks for the reply's both of u guys but it doesn't seem to work with what u said and instead i used this
    =COUNTIF(Clients!$B$4:$B$500,"*"&Sheet2!$A$3:Sheet2!$A$500&"*") but now i have another issue.
    This formula cant see the blank shells in sheet2 and counts them all the same.
    Got any idea about an IF statement i can use to check for empty shells in column A sheet 2?

  7. #7
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: VBA code for countif to look for a specific words

    That formula doesn't make sense.

    Can you attach a sample workbook? Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  8. #8
    Registered User
    Join Date
    10-11-2016
    Location
    greece
    MS-Off Ver
    2007
    Posts
    5

    Re: VBA code for countif to look for a specific words

    one.PNG This is my client sheet and the products go on column B.


    second.PNG And this is my Warehouse sheet.

    In the Warehouse sheet i will put a lot of products on column A and their amount on column B.
    What i want is when i put one of the products on client sheet column B to tell me how much i have
    on Warehouse sheet Column C.
    I just want to count how many of the products i have sold by their name.
    What i want is to be able to put a formula on Warehouse sheet column C that can look
    what name i have on column A(warehouse sheet) look for that name on client sheet column B
    and tell me the amount.
    One restriction i have is that clients may buy 2 or 3 different items so i want the formula to be able to count
    that specific item out of 2-3 that are on the same sentence, all the items will be separated with a comma.
    (ex. item1,item2,item3)i want to be able to see the difference and count them where it needs to).
    Attached Images Attached Images

  9. #9
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: VBA code for countif to look for a specific words

    I can't work from images, and I'll be damned if I'm re-keying your data. Please, attach a workbook. Please include some sample product data, and an example (manually mocked up) of what your required outcome actually looks like.

  10. #10
    Registered User
    Join Date
    10-11-2016
    Location
    greece
    MS-Off Ver
    2007
    Posts
    5

    Re: VBA code for countif to look for a specific words

    Here is my workbook , as u can see on sheet 2 column C every shell that doesn't have a value in column A
    it counts all of them and if there is a value to compare it does it correctly.
    Attached Files Attached Files

  11. #11
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: VBA code for countif to look for a specific words

    Okay, so in sheet [Apothiki] cell C3, enter:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    and copy down.

+ 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. [SOLVED] counting occurrence of specific words in another group of words
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-02-2021, 07:33 PM
  2. Replies: 15
    Last Post: 10-12-2014, 08:53 AM
  3. Color Code Specific Words and Punctation Marks Within Cells
    By khines19 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-06-2014, 05:28 PM
  4. [SOLVED] looking formula for Extract Specific WORDs in existing LONG Words
    By santosh226001 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-07-2013, 08:21 AM
  5. Replies: 0
    Last Post: 04-29-2013, 03:13 PM
  6. Replies: 3
    Last Post: 12-21-2012, 05:33 AM
  7. Highlight a row if a specific cell is specific numbers/words
    By sea0221 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-08-2005, 09:06 PM

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