# If statement help needed



## PWil84

Hello all,

I'm trying to assign all of the expenses that have "Public" in the expense description as operations management in nother field and all other expense that don't have "Public" as "Some other Department". When I run the if statement below as part of my Select query it returns all of the records with "Some other Department" in the newly created field column. For more details please see below:


----------



## arthurbr

The IF function does not support wildcards
Try something similar (with your structured references to 
	
	
	
	
	
	




		Excel Formula:
__


=IF(ISERROR((ISNUMBER(SEARCH("Public",A1))),"Some Other Dept","Operations Management")


----------



## welshgasman

That is an excel formula, surely?, question is Access in the Access forum?


----------



## welshgasman

Use Instr() to find the Public string


----------



## I_know_nuffin

Use like instead of =


----------



## arthurbr

welshgasman said:


> Use Instr() to find the Public string


That is correct. OTOH as OP used IF in his title, I thought he had posted in the wrong forum. My mistake


----------



## Joe4

arthurbr said:


> That is correct. OTOH as OP used IF in his title, I thought he had posted in the wrong forum. My mistake


Besides posting it in the Access Forums, the details of the original post also kind of give it away (clearly an Access IIF formula, and screen print of an Access Query).


----------

