+ Reply to Thread
Results 1 to 5 of 5

Read a Range of 5 cells of strings and assign value of 1-5

  1. #1
    Registered User
    Join Date
    12-26-2011
    Location
    San Francisco
    MS-Off Ver
    Excel 2010
    Posts
    45

    Read a Range of 5 cells of strings and assign value of 1-5

    Let's say I have a range of 5 cells:

    Apple
    Hobo
    Mimi
    Zach
    Tony

    I want to assign a value of 1 to Apple, 2 to Hobo, 3 to Mimi, 5 to Zach, 4 to Tony

    Any ideas? Keep in mind this Range could have unknown length (will be a lot more than 5 cells)

  2. #2
    Registered User
    Join Date
    12-26-2011
    Location
    San Francisco
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: Read a Range of 5 cells of strings and assign value of 1-5

    As a follow-up, I would love to do the same thing with numerical values. If my Range is:

    100
    200
    3000
    50
    5

    I want to assign 1 to 5, 2 to 50, 3 to 100, 4 to 200 and 5 to 3000

    My new range should look like: { 3, 4, 5, 2, 1 }

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,592

    Re: Read a Range of 5 cells of strings and assign value of 1-5

    You need to define somewhere your text and their values.

    Then with VLOOKUP formula you can call this values.

  4. #4
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Read a Range of 5 cells of strings and assign value of 1-5

    aswering your first post You can select your range and run tis code
    Please Login or Register  to view this content.
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  5. #5
    Registered User
    Join Date
    12-26-2011
    Location
    San Francisco
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: Read a Range of 5 cells of strings and assign value of 1-5

    Tom1977, just to be clear, I am coming up with the values for ar1 based on the alpha order. I do not know ar1 beforehand. I want the output of this to be ar1

+ 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