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)
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)
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 }
You need to define somewhere your text and their values.
Then with VLOOKUP formula you can call this values.
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.
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks