+ Reply to Thread
Results 1 to 5 of 5

code to convert numbers to other set of numbers

  1. #1
    Registered User
    Join Date
    06-10-2010
    Location
    Boston, MA
    MS-Off Ver
    Excel 2003
    Posts
    2

    code to convert numbers to other set of numbers

    Apologies for the confusing title. This is my first post, although I have often read others' posts and learned a lot of great stuff. I have a sheet that contains a list of numbers which correspond to values. There are 22 numbers, and each one corresponds to a different value. For example, 1 may correspond to 5, 2 = 9, 3=7, etc. Obviously I can't do an IF formula because there are too many tests. What is the best way to go about this? I would like to be able to enter the raw data into column A and run a formula or macro to display the converted values in column B. Any leads are greatly appreciated.

    Many thanks.
    Last edited by jfkeith; 06-10-2010 at 08:50 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: code to convert numbers to other set of numbers

    You could accomplish this with a simple lookup table and a VLOOKUP formula in column B.

    Create a two-column reference table and then try VLOOKUP()
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: code to convert numbers to other set of numbers

    Try out this example,
    Enter 1 to 8 in the yellow cells in column A the Vlookup Formula is in Column B, the table is in the Table Sheet
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    06-10-2010
    Location
    Boston, MA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: code to convert numbers to other set of numbers

    Quote Originally Posted by JBeaucaire View Post
    You could accomplish this with a simple lookup table and a VLOOKUP formula in column B.

    Create a two-column reference table and then try VLOOKUP()
    Worked perfectly!! Thank you so much!

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: code to convert numbers to other set of numbers

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ 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