VLOOKUP
Yet another approach, with a bit more flexibility in long run, but more work now, is to use the VLOOKUP
function.
This requires you to have a lookup table where you have in first column the values you want to look up (e.g. "WT", "AT". etc.).
In column to the right you then put values you want to "convert" them to. (Technicaly it is not conversion, it's just a lookup :) )
So you set up a lookup table for example in range A1:B4:
Result NumericEquivalent
WT -1
AT 0
AB 1
Formula: =VLOOKUP(S2, $A$1:$B$4, 2, FALSE)
. The S2
should contain any of the WT AT AB.
Explanation and links:
MS VLOOKUP function
In its simplest form, the VLOOKUP function says:
=VLOOKUP(Value you want to look up, range where you want to lookup the value, the column number in the range containing the return value,
Exact Match or Approximate Match – indicated as 0/FALSE or 1/TRUE).
"
s around letter scores too, ("WT"
), and it doesn't have the same logic as you've described, but otherwise it seems ok. What exactly the issue is with it? (Yes, this forum is to help each other, but not in a dumb way, instead we try to really understand the issue before helping, and that requires well written questions too.)