If/or or Vlookup

MermaidNiki

New Member
Joined
Oct 27, 2014
Messages
6
Hi,
I need another complex if/or statement. I created one that would in theory work, but it has too many arguments. I have a cell that contains IDs for 33 monkeys. Each monkey will be listed as high ranking (h), middle ranking (m), or low ranking (l) in another column. Here is my code with too many arguments:
=IF(OR(J2=“rn”, J2=“tl”, J2=“wj”, J2=“an”, J2=“rj”, J2=“fd”, J2=“zd”, J2=“od”, J2=“id”, J2=“td”, J2=“qd”, J2=“ul”, J2=“uk”, J2=“ql”, J2=“fm”, J2=“ba”, J2=“bp”, J2=“cp”, J2=“aa”, J2=“rp”, J2=“up”, J2=“ak”, J2=“ll”, J2=“mm”, J2=“kn”, J2=“om”, J2=“ej”, J2=“nu”, J2=“qs”, J2=“hs”, J2=“cu”, J2=“fu”, J2=“gs”),”h”,”h”,”m”,”l”,”l”,”h”,”h”,”m”,”m”,”l”,”l”,”h”,”h”,”m”,”l”,” h”,”h”,”m”,”m”,”l”,”l”,”h”,”h”,”m”,”m”,”l”,”l”,”h”,”h”,”m”,”m”,”l”,”l”)

Is there a way to combine these somehow or perhaps a more efficient code? The other identifier I can use is that these monkeys are in 3 different groups and there is a separate column that defines this (R2, R1, and PB). I can list which monkeys are in which group if it helps.

Thank you in advance!
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

FDibbins

Well-known Member
Joined
Feb 16, 2013
Messages
6,723
I would make a small table with codes and rank, then use VLOOKUP. Something like...
E​
F​
G​
H​
I​
J​
1​
rnh
2​
tlhhrn
3​
wjm
4​
anl
5​
rjl
I2=VLOOKUP(J2,$E$1:$F$5,2,0)

I obviously did not use all of your codes, so add what you need and adjust the range accordingly
 
Upvote 0

MermaidNiki

New Member
Joined
Oct 27, 2014
Messages
6
Perfect! Thank you - this did exactly what I needed it to and will help immensely in the future.

I would make a small table with codes and rank, then use VLOOKUP. Something like...
E​
F​
G​
H​
I​
J​
1​
rnh
2​
tlhhrn
3​
wjm
4​
anl
5​
rjl

<tbody>
</tbody>

I2=VLOOKUP(J2,$E$1:$F$5,2,0)

I obviously did not use all of your codes, so add what you need and adjust the range accordingly
 
Upvote 0

Forum statistics

Threads
1,195,635
Messages
6,010,831
Members
441,569
Latest member
PeggyLee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top