vlookup laste 6 digit.

Vanda_a

Well-known Member
Joined
Oct 29, 2012
Messages
934
hello all. please help me out with this.

in sheet1 I have a data with 13digit barcode.
and in sheet2. I have only last 6digit of the barcode.
Can I use vlookup for this thing? vlookup 6digit to the 13digit barcode.

Thanks for help
 
How about posting a few rows worth of sample data and tell us what result you expect.
A
B
C
D
E
F
1
1234567890123
A
890123
formula
Result from A column
From B
2
0123456789123
B
789123
formula
Result from A column
From B

<tbody>
</tbody>
Is it possible?
Many thanks
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
A
B
C
D
E
F
1
1234567890123
A
890123
formula
Result from A column
From B
2
0123456789123
B
789123
formula
Result from A column
From B

<TBODY>
</TBODY>
Is it possible?





Many thanks
Like this...

Book1
ABCDEF
21234567890123A890123formula1234567890123A
30123456789123B789123formula0123456789123B
Sheet1

This array formula** entered in E2:

=INDEX(A$2:A$3,MATCH("*"&$C2,$A$2:$A$3&"",0))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.

Copy across to F2 then down as needed.
 
Upvote 0
Like this...

Sheet1

ABCDEF
21234567890123A890123formula1234567890123A
30123456789123B789123formula0123456789123B

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:96px;"><col style="width:37px;"><col style="width:61px;"><col style="width:59px;"><col style="width:101px;"><col style="width:37px;"></colgroup><tbody>
</tbody>

This array formula** entered in E2:

=INDEX(A$2:A$3,MATCH("*"&$C2,$A$2:$A$3&"",0))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.

Copy across to F2 then down as needed.

many thanks
 
Upvote 0
Like this...

Sheet1

ABCDEF
21234567890123A890123formula1234567890123A
30123456789123B789123formula0123456789123B

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:96px;"><col style="width:37px;"><col style="width:61px;"><col style="width:59px;"><col style="width:101px;"><col style="width:37px;"></colgroup><tbody>
</tbody>

This array formula** entered in E2:

=INDEX(A$2:A$3,MATCH("*"&$C2,$A$2:$A$3&"",0))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.

Copy across to F2 then down as needed.

one more problem comes up. It says array formula are not valid in merged cells. please help
 
Upvote 0
one more problem comes up. It says array formula are not valid in merged cells. please help

Try to unmerge the cells.

Does this work for cells merged and unmerged:

E2, just enter, copy across, and down:

=LOOKUP(9.99999999999999E+307,FIND($C1&"|",$A$2:$A$3&"|"),A$2:A$3)
 
Last edited by a moderator:
Upvote 0
amazing Aladin, how does the formula works?

Let BigNum = 9.99999999999999E+307

1. LOOKUP(BigNum,Reference)

yields the last numeric value from Reference, which can be an ordinary range (like A2:A4) or a calculated array (like {7,1,#VALUE!,2,#VALUE!}.

2. LOOKUP(X,Reference1,Reference2)

yields the correlate from Reference2 which is given by the position of X in Reference1.

3. LOOKUP(BigNum,Reference1,Reference2)

operates likewise and returns from Reference2 the corelate of the last numeric value of Reference1.

Example: LOOKUP(BigNum,{1,7,4},{"Kad","Nad","Jad"}) ==> Jad

4. The following are the kernel citations:

http://www.mrexcel.com/forum/excel-questions/102091-9-9999999-a.html (Post #3)
http://www.mrexcel.com/forum/excel-questions/310278-vlookup-multiple-matches-match-returned.html (Post #7, algorithmic description)

5. FIND(X,Reference)

does a search for X in Reference, yielding an array result, something like:

{8;#VALUE!}

Note that the last numeric value is 8 and this value is at position #1.

6. FIND(X&"|",Reference&"|")

adds to X a | at the end, making the search for a substring ending with |. The same action is taken with adding a | char to Reference at its end.

So, searching 123 in 2345123768 becomes searchin for 123| in 2345123768|, which will fail (as intended). But looking for 123 in 32489123 will succeed as intended. To re-cap: The action effects a filtering of "Ends With".


7. By [3] and [6], we can write:

LOOKUP(9.99999999999999E+307,FIND($C2&"|",$A$2:$A$3&"|"),A$2:A$3)

which will determine the position of the value of C2 in $A$2:$A$3 and deliver the value in A$2:A$3 at that position.

Q.E.F.
 
Upvote 0
Let BigNum = 9.99999999999999E+307

1. LOOKUP(BigNum,Reference) ... ... ...


7. By [3] and [6], we can write:

LOOKUP(9.99999999999999E+307,FIND($C2&"|",$A$2:$A$3&"|"),A$2:A$3)

which will determine the position of the value of C2 in $A$2:$A$3 and deliver the value in A$2:A$3 at that position.

Q.E.F.
My mind = blown.
 
Upvote 0

Forum statistics

Threads
1,215,086
Messages
6,123,033
Members
449,092
Latest member
ikke

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
Back
Top