Wildcard in a String does not work

• Hi, I am trying to count all the Disagrees in a column (Disagree 1 to Disagree 10) with the below code, but it does not work. Is there another wildcard that may work, or don't wildcards work.

If not, how can I make the code count all the Disagrees, cheers.

• You can't use wildcards with = but you can with Like, so use:

Code
``x(i, 11) Like Status``

Note that this will be case-sensitive. If that's a problem, convert both bits of text to either lower or upper case.

Rory
Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

• Thanks Rory, I'll give it a try, cheers

• Hi Rory, I get this when I enter "Like" and it turns blue.

• You don't need the = sign. Also, the uUCase is what Rory suggested in case there was a problem cause by case sensitivity

Code
``If UCase(x(i, 2)) Like UCase(Category) And UCase(x(i, 11)) Like UCase(Status) Then``
• Hi royUK , the code runs but no results appear. "Disagree" is lower case in the data and my Disagree is lower case in the code, is there something else I need to do? Cheers

Code
``If UCase(x(i, 2)) Like UCase(Category) And UCase(x(i, 7)) Like UCase(Status) Then ``
• royUK , I put the wildcard back in after Disagree*, and it worked so far. Is that correct.... I need the *.

• Yes, you need the wildcard for Like.

Rory
Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!