+ Reply to Thread
Results 1 to 8 of 8

Macro to change a multiplier based on a zipcode

  1. #1
    Registered User
    Join Date
    04-16-2011
    Location
    moorhead, mn
    MS-Off Ver
    Excel 2003
    Posts
    8

    Macro to change a multiplier based on a zipcode

    I have cell A18 CITY STATE ZIPCODE

    I Have cell G15 A formula G14*.06875

    I would like to be able to have a macro that
    that I could put a certain zipcode in to find
    and then change the multiplier.

    I am trying to attach workbook.
    It's been a few years since I have used the forum but
    has been very helpful.
    Linda
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,893

    Re: Macro to change a multiplier based on a zipcode

    I don't think you need a macro for this. A simple table with zip codes and multipliers would suffice to make a vlookup function work.

    On a new sheet put your table in the following format
    v A B C
    1 Zip Code Multiplier
    2 80487 0.0685
    3 60444 0.0523
    4 60445 0.0522
    5 91322 0.0875
    6 56515 0.06852
    7
    8

    Then in cell G15 put this formula

    =G14*VLOOKUP(RIGHT(A18,5)*1,Sheet1!$A$2:$B$7,2,0)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    04-16-2011
    Location
    moorhead, mn
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Macro to change a multiplier based on a zipcode

    Thanks so much for your help and putting your idea to good use however:
    is there anyway I can add something into the formula that if the zip code is
    not on sheet 1 the value that is in G15 stays as is it will not change?

    Thanking you in advance if you can suggest a solution.

    Linda

  4. #4
    Registered User
    Join Date
    04-16-2011
    Location
    moorhead, mn
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Macro to change a multiplier based on a zipcode

    Quote Originally Posted by alansidman View Post
    I don't think you need a macro for this. A simple table with zip codes and multipliers would suffice to make a vlookup function work.

    On a new sheet put your table in the following format
    v A B C
    1 Zip Code Multiplier
    2 80487 0.0685
    3 60444 0.0523
    4 60445 0.0522
    5 91322 0.0875
    6 56515 0.06852
    7
    8

    Then in cell G15 put this formula

    =G14*VLOOKUP(RIGHT(A18,5)*1,Sheet1!$A$2:$B$7,2,0)
    Can you help another step please...If the zip code is not listed on Sheet1 could the formula have something in it so it would leave the cell as is?

  5. #5
    Registered User
    Join Date
    04-16-2011
    Location
    moorhead, mn
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Macro to change a multiplier based on a zipcode

    Can you help another step please...If the zip code is not listed on Sheet1 could the formula have something in it so it would leave the cell as is?

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,893

    Re: Macro to change a multiplier based on a zipcode

    You will need a macro in this situation. Try this untested one, assuming your vlookup table is as previously shown

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-16-2011
    Location
    moorhead, mn
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Macro to change a multiplier based on a zipcode

    Thanks oh so much for your help.
    Linda

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,893

    Re: Macro to change a multiplier based on a zipcode

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. zipcode based on address, city, and state
    By lawalk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-25-2016, 01:17 PM
  2. Replies: 7
    Last Post: 05-24-2016, 05:09 PM
  3. Add multiplier based on text
    By kevinjay1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-09-2013, 10:47 AM
  4. Replies: 2
    Last Post: 08-07-2013, 09:01 AM
  5. Freight calculator based on zipcode, weight and type
    By Verox in forum Excel Formulas & Functions
    Replies: 23
    Last Post: 04-29-2013, 05:33 AM
  6. How to change the multiplier based on the sum of 2 numbers
    By Jcarpent in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-14-2013, 11:22 PM
  7. Replies: 1
    Last Post: 04-15-2006, 12:45 PM

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