Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIf Function Question

Status
Not open for further replies.

ChiTownDiva

Technical User
Jan 24, 2001
273
US
Afternoon All...

I have an IIf function question. I have some store numbers:

42
78
189
23706
30706
35706
107706
121706

Here's my problem--I want to keep the digits in front of 706, so I want to write a formula or module that uses:

If Right([StoreNumber], 3) = 706 then

Left([storenumber], Instr([storenumber], "706")-1) else [storenumber]


I tried:

IIf(Right([storenumber], 3) Like "706",Left([storenumber],InStr([storenumber],"706")-1),[storenumber])

Of course, this doesn't work.

What am I doing wrong?

Thanks in advance.


ChiTownDiva [ponytails2]
 
As soon as I hit the "Submit" button, I figured it out...

IIf(Right([STORE #],3) Like "706",Left([store #],InStr([store #],"706")-1),[STORE #])

Thanks anyway...

ChiTownDiva [ponytails2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top