MS Access Query Error

chris1979

Board Regular
Joined
Feb 23, 2016
Messages
52
Hi Guys
I have a requirement where I have select three different criteria in work. I have to select all the data which starts "BAN*" (rename as BLR), again select the data which starts MAD* and rename as CHN and the rest as Others
I have tried using switch, iff and like statements but never works
Team: Iff([City] Like "BAN*","BLR",IIf([Library Item] Like "MAD*","CHN","Others"))
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Not enough info to offer focused response. Tell us about WHAT you are trying to accomplish in plain English and provide some info re your tables.
It is often more helpful if you show the SQL underlying your query.

I'm sure this is clear to you, but some explanation for the readers would help.
"rename as CHN and the rest as Others "
Good luck with your project.
 
Upvote 0
I have tried using switch, iff and like statements but never works
Team: Iff([City] Like "BAN*","BLR",IIf([Library Item] Like "MAD*","CHN","Others"))

As far as it goes your expression looks correction enough except Access does NOT have an IFF function. It has an IIF function, so you need to fix that.
 
Upvote 0
Thank you for your feedback and time. I have tried the formula with some minor changes and it worked.
Thanks once again
 
Upvote 0

Forum statistics

Threads
1,215,731
Messages
6,126,537
Members
449,316
Latest member
sravya

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