15

So, I used the left function to take the first 4 characters of a string and I need to run a vlookup with it, but it won't find the match because it's looking through numbers.

I want to do this in a macro, so I'm not sure about the syntax. Can someone help?

user960358
  • 295
  • 3
  • 6
  • 14

2 Answers2

38

use the val() function

malificent
  • 1,441
  • 14
  • 18
5

If, for example, x = 5 and is stored as string, you can also just:

x = x + 0

and the new x would be stored as a numeric value.

asalamanca
  • 51
  • 1
  • 1