+ Reply to Thread
Results 1 to 2 of 2

Using If Statement for Zip Code

  1. #1
    Registered User
    Join Date
    06-13-2006
    Posts
    45

    Using If Statement for Zip Code

    I'm inputting addresses into an worksheet and some of the city names are related to only one zip code. Ideally I'd like to enter Ponte Vedra Beach into k2 and have 32082 appear in M2. If I input anything else, then I'd simply like to be able to type in the correct zip code. I don't normally work with IF statements, but I looks as if I should be using a Value_if_true statement.

    Is that correct and if so should the statement look something like this:
    =IF(k2="Ponte Vedra Beach","32082") Except that is missing where the 32082 should be displayed.

    Thanks for any help.

    Jon

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    Hi Jonhunt,

    In order for the zip code to show up in M2, you'd have to place that formula in M2. Of course this causes a problem, because if it's not Ponte Vedra Beach and you enter a zip code into cell M2 manually, your formula is now gone!

    As you surmised, the formula in M2 would be

    =IF(K2="Ponte Vedra Beach","32082","")

    But to get the functionality you require, you'd have to use a macro in the worksheet's change event. Something like this might work:
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1