excel vba - vlookup between values of different length -
i'm trying vlookup() best match between 2 rows length of values different.
35799700000 1902718 x1 35796961001 3584570 x2 35796961001 3584573 x3 35799700000 3584575 x4 35795977777 3584576 x5 351309312001 3579 x6 35795977777 41 x7 417999838729 67572210124 320301120086
for example first number 35799700000
should bring me 3579
can me?
i've made assumptions because haven't been descriptive in question
the formula below resizes lookup table values same length lookup value. e.g. when comparing 35799700000
, lookup value 41
41000000000
in lookup table. once lookup table values have been scaled closest number lookup value calculated using min()
, abs()
, , corresponding x1
,x2
... etc returned (i assumed setup above)
{=index($e$1:$e$7,match(min(abs(($d$1:$d$7*(10^(len($a2)-len($d$1:$d$7))))-$a2)),abs(($d$1:$d$7*(10^(len($a2)-len($d$1:$d$7))))-$a2),0))}
this array formula leave out curly braces , enter using ctrl+shift+enter
image of working model below. if don't use same setup, need change cell references in formula
Comments
Post a Comment