Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need Help with Nested IIf

    Need Help with Nested IIf

  2. #2
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Need Help with Nested IIf

    I would try it this way:
    <pre>IIf(Len([ZIP])=7,[ZIP],Left([ZIP],5)) </pre>

    When I tested this I got either 5-char US zip or 7-char Canadian zip as result.
    HTH

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Need Help with Nested IIf

    Hi Mark

    After further review my input zip codes looked liked this:

    ZIP
    12345 (Zip)
    54321-1024 (Zip Plus 4)
    67890-
    A1A 1A1 (Canidian Postal)

    Following IIf handled all requirements:

    ZipCode: IIf(Len([ZIP])=10, Left([ZIP],5), IIf(Len([ZIP])=7, Left([ZIP],7), IIf(Len([ZIP])=6, Left([ZIP],5), [ZIP])))

    12345 (Zip)
    54321 (Zip Plus 4)
    67890
    A1A 1A1 (Canidian Postal)

    Thanks, John

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •