+ Reply to Thread
Results 1 to 8 of 8

Return value after searching 3 col's of zipcodes

  1. #1
    Registered User
    Join Date
    05-11-2011
    Location
    Victoria Australia
    MS-Off Ver
    Excel 2000
    Posts
    5

    Return value after searching 3 col's of zipcodes

    Hi everyone, I know the basics but this is beyond me.

    I run a small courier Co and charge a fixed rate between towns in set zones, I have 3 columns of Zip-codes (Postcodes here in Oz) corresponding to the zones and wish to input two codes and return a dollar value based on what zone they are in.

    My criteria is for example:
    Any two codes from zone one is $20.00
    Any two codes from zone two is $22.50
    Any two codes from zone three is $25.00
    Any one code from zone one and either of the other zones is the $ value of the higher zone plus $8.00 and the same for between zones two and three (the higher value plus $8.00)

    I hope this makes sense and is do-able.

    Oscar
    Last edited by Oscar Fox; 05-13-2011 at 10:04 AM.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Return value after searching 3 col's of zipcodes

    Hi,

    I think you would probably be better off having one column of ZIP codes and the zone that the code relates to in the column next to it.

    You can then do a lookup for both your zip codes on that one table and use a logical function to determine the cost based on the zones that are returned.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Return value after searching 3 col's of zipcodes

    Hi Oscar Fox

    Welcome to the forum

    This is doable, but so much easier to check if you provide a workbook with the three relevant columns.

    It should not contain any sensitive data.


    Cheers

    From Forum FAQs

    How do I attach a file to a post?

    To attach a file to your post, you need to be using the main 'New Post' or 'New Thread' page and not 'Quick Reply'. To use the main 'New Post' page, click the 'Post Reply' button in the relevant thread.

    On this page, below the message box, you will find a button labelled 'Manage Attachments'. Clicking this button will open a new window for uploading attachments. You can upload an attachment either from your computer or from another URL by using the appropriate box on this page. Alternatively you can click the Attachment Icon to open this page.

    To upload a file from your computer, click the 'Browse' button and locate the file. To upload a file from another URL, enter the full URL for the file in the second box on this page. Once you have completed one of the boxes, click 'Upload'.

    Once the upload is completed the file name will appear below the input boxes in this window. You can then close the window to return to the new post screen.

  4. #4
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Return value after searching 3 col's of zipcodes

    I put together an example if it helps.

    Dom
    Attached Files Attached Files

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Return value after searching 3 col's of zipcodes

    3 columns containing zipcodes: A:C

    first zipcode: E1
    second zipcode E2
    tariffresult in E3

    Please Login or Register  to view this content.



  6. #6
    Registered User
    Join Date
    05-11-2011
    Location
    Victoria Australia
    MS-Off Ver
    Excel 2000
    Posts
    5

    Re: Return value after searching 3 col's of zipcodes

    Man you guy's are great (and fast)

    Domski, I like the ease of the single column. Would it be easy to add a second column of data corresponding to the zipcode that would print out the town name when the zipcode is entered.
    Sorta gives a reassuring confirmation that the right towns zip was entered.

    Anyway thanks for the instant and brilliant help.
    Oscar

  7. #7
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Return value after searching 3 col's of zipcodes

    Hi Oscar,

    Sure, see the revised example attached.

    Dom
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    05-11-2011
    Location
    Victoria Australia
    MS-Off Ver
    Excel 2000
    Posts
    5

    Re: Return value after searching 3 col's of zipcodes

    Quote Originally Posted by Domski View Post
    Hi Oscar,

    Sure, see the revised example attached.

    Dom
    I had a good play with your code and found it did most of what I wanted nice and cleanly, BUT..... I hit a snag when I realized that some of my zips were in two or more adjacent zones where the zone boundary overlaps and wouldn't return the correct pricing. I think this was why I was originally playing with 3 columns of data not a single one. I sat back down and wrote a new condition table.

    Zones are A, B, C, all else D
    Any two zips in: A=$20 B=$25 C=$30
    One zip in each: AB=$28 AC=$32 BC=$35 except where they appear wholly in A,B or C
    Any other combination returns"ask for pricing"

    Each Zone corresponds to a column of zip data and some data may appear in more than one column.

    My brain is now officially mush and no amount of code manipulation seems obvious to me, please HELP........

+ 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