Excel and MS Query issue

Excel_Zero

New Member
Joined
Apr 25, 2014
Messages
13
Hello,

I'm utilizing MS query in excel and can get the user to input a value in a cell and then the report refreshes for this specific criteria, say if they select North or South. However I want a report that uses this cell but brings back all data that meets that criteria, so in the example, they would input North and you would get North but also North East and North West.

The function to use is 'Contains' which would use the LIKE function.

The following should work --> Like"*"&[Enter character string]&"*"

but a prompt appears saying "The data types char and char are incompatible in the '&' operator".
The quotation marks then amend to square brackets, so it is effectively asking for 3 user inputs, ie it shows -->
Like [*] & [Enter character string] & [*]

I have tried amending the * character to a % character, in case the wildcard needed to be different and also the & character to a + character, but again to no resolution.

Does anyone have an idea why, or how to use the Like function with a user input. My version of MS query is 2010.

Many thanks
 
Maybe a roundabout way: set the query parameter to cell A2, containing the formula "*"&A1&"*" and have the user input the search for string in A1. Not the most elegant approach, I admit, but it might work.
 
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Thanks Noodleski but again as happened with Rory's suggestion, it then seems to just want to look for *North*, so it doesn't treat the * symbol as a wildcard.
 
Upvote 0
That's odd - this previous thread indicated it worked.
 
Upvote 0
Odd indeed and if typing the suggestion in the other thread I get : Invalid use of '.', '!' or '0' (presuming I am typing it correctly.
I also wasn't sure on the previous thread how it prompts for a user input?

Cheers
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top