Lookup within multiple columns

Cyphas

New Member
Joined
Oct 23, 2021
Messages
12
Office Version
  1. 365
Platform
  1. Windows
  2. Web
I have a supplier who decided to populate data in a complex way thus making life a bit difficult in working with a form.

Item are placed like the below table.. this is just 1/8 of contents. I need to lookup in this sheet find the supplier code which is in either column A, C, E or G then return the relevant barcode number to the right of it.. so the value is in either columns B,D,F,H on the same row. Is there a VLOOKUP or equivalent formula to do this. I came across using some VLOOKUP and INDIRECT but couldnt figure out how to use in this complex instance as the main sheet I am using has a field supplier_code like 'J1' of which I need to ppopulate field sku_ean with the barcode from this sheet

JCB Barcode List Customer 02.12.21.xls
ABCDEFGH
2AMAZON
3J15055559602415J75055559602477J135055559610120J195055559631316
4J25055559602422J85055559602484J145055559610137J205055559631323
5J35055559602439J95055559602491J155055559610144J215055559631330
6J45055559602446J105055559602507J165055559610151J225055559631347
7J55055559602453J115055559602514J175055559612322J235055559631354
8J65055559602460J125055559602521J185055559612339
9
10
11AZTEC
12AL15055559602989AL65055559603030AL115055559603085AL165055559605218
13AL25055559602996AL75055559603047AL125055559603092AL175055559605225
14AL35055559603009AL85055559603054AL135055559605188AL185055559610267
15AL45055559603016AL95055559603061AL145055559605195AL195055559610274
16AL55055559603023AL105055559603078AL155055559605201AL205055559610281
17CRAFT COTTON3PLY5060019090312BLEND 25060019095614Toyball5060019095621
18ECRU5060019092026
19BLEACH5060019092033
20BABY 4PLY 100g
21BY15060019090220BY45060019090251BY85060019090299BY115055559610670
22BY25060019090237BY55060019090268BY95060019090305BY125055559610687
23BY35060019090244BY65060019090275BY105055559610663
24BABY 4PLY CONE
254BY150600190904114BY450600190904424BY850600190904804BY125055559624370
264BY250600190904284BY550600190904594BY95060019090497
274BY350600190904354BY650600190904664BY115055559624363
BARCODE MASTER


Thank you in advance for your help.

If Lookup is not ideal then is there a way to run a code to make populating in a sheet data into two columns
So I have all like

JCB Barcode List Customer 02.12.21.xls
AB
3Supplier CodeEAN
4J15055559602415
5J25055559602422
6J35055559602439
7J45055559602446
8J55055559602453
9J65055559602460
BARCODE MASTER
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
this may not work on the real data - works for sample and I'm sure there are better ways

i have used J2 for the Value to lookup
=ADDRESS(MIN(IF(A1:H26=J2,ROW(A1:H26))),MIN(IF(A1:H26=J2,COLUMN(A1:H26)+1)))
This returns the address that value is in
then I used indirect
=INDIRECT(ADDRESS(MIN(IF(A1:H26=J2,ROW(A1:H26))),MIN(IF(A1:H26=J2,COLUMN(A1:H26)+1))))
and added 1 to the column
to return the corresponding value

for some reason the numbers on the XL2BB when copied into the sheet are all the same
so i changed a few as a test - See G11/H11

Book4
ABCDEFGHIJK
1AMAZON
2J15.05556E+12J75.05556E+12J135.05556E+12J195.05556E+12AL16FRD
3J25.05556E+12J85.05556E+12J145.05556E+12J205.05556E+12
4J35.05556E+12J95.05556E+12J155.05556E+12J215.05556E+12
5J45.05556E+12J105.05556E+12J165.05556E+12J225.05556E+12
6J55.05556E+12J115.05556E+12J175.05556E+12J235.05556E+12
7J65.05556E+12J125.05556E+12J185.05556E+12
8
9
10AZTEC
11AL15.05556E+12AL65.05556E+12AL115.05556E+12AL16FRD
12AL25.05556E+12AL75.05556E+12AL125.05556E+12AL175.05556E+12
13AL35.05556E+12AL85.05556E+12AL135.05556E+12AL185.05556E+12
14AL45.05556E+12AL95.05556E+12AL145.05556E+12AL195.05556E+12
15AL55.05556E+12AL105.05556E+12AL155.05556E+12AL205.05556E+12
16CRAFT COTTON3PLY5.06002E+12BLEND 25.06002E+12Toyball5.06002E+12
17ECRU5.06002E+12
18BLEACH5.06002E+12
19BABY 4PLY 100g
20BY15.06002E+12BY45.06002E+12BY85.06002E+12BY115.05556E+12
21BY25.06002E+12BY55.06002E+12BY95.06002E+12BY125.05556E+12
22BY35.06002E+12BY65.06002E+12BY105.05556E+12
23BABY 4PLY CONE
244BY15.06002E+124BY45.06002E+124BY85.06002E+124BY125.05556E+12
254BY25.06002E+124BY55.06002E+124BY95.06002E+12
264BY35.06002E+124BY65.06002E+124BY115.05556E+12
Sheet1
Cell Formulas
RangeFormula
K2K2=INDIRECT(ADDRESS(MIN(IF(A1:H26=J2,ROW(A1:H26))),MIN(IF(A1:H26=J2,COLUMN(A1:H26)+1))))
 
Last edited:
Upvote 0
I used K1 for the value to lookup, this solution is non volatile So it might make your worksheet faster if you have alot of data:
Excel Formula:
=IFERROR(OFFSET(A1,MATCH(K1,A2:A26,0),1),"") & IFERROR(OFFSET(A1,MATCH(K1,C2:C26,0),3),"")& IFERROR(OFFSET(A1,MATCH(K1,E2:E26,0),5),"")& IFERROR(OFFSET(A1,MATCH(K1,G2:G26,0),7),"")
 
Upvote 0
Solution
I used K1 for the value to lookup, this solution is non volatile So it might make your worksheet faster if you have alot of data:
Excel Formula:
=IFERROR(OFFSET(A1,MATCH(K1,A2:A26,0),1),"") & IFERROR(OFFSET(A1,MATCH(K1,C2:C26,0),3),"")& IFERROR(OFFSET(A1,MATCH(K1,E2:E26,0),5),"")& IFERROR(OFFSET(A1,MATCH(K1,G2:G26,0),7),"")
Great this worked! Thanks
 
Upvote 0
Glad it worked, however can I correct my statement, OFFSET is a volatile function
 
Upvote 0
Glad it worked, however can I correct my statement, OFFSET is a volatile function
I think there may be some issues in the code.. I was trying to Figure out where the issue is but think I'm lost

JCB Barcode List Customer 02.12.21.xls
ABCDEFGHIJKL
1MASTER Barcode List
2Actual returned from code
3Supplier CodeEANSupplier CodeEANExpected Return Value
4J15055559602415J75055559602477J135055559610120J195055559631316BY150600190902205060019090220
5J25055559602422J85055559602484J145055559610137J205055559631323BY250600190902375060019090237
6J35055559602439J95055559602491J155055559610144J215055559631330BY350600190902445060019090244
7J45055559602446J105055559602507J165055559610151J225055559631347PT1350555596238475055559623847
8J55055559602453J115055559602514J175055559612322J235055559631354BY450600190902515060019090251
9J65055559602460J125055559602521J185055559612339BY550600190902685060019090268
10BY650600190902755060019090275
11AL1150555596030855055559603085
12AZTECAL1250555596030925055559603092
13AL15055559602989AL65055559603030AL115055559603085AL165055559605218AL1350555596051885055559605188
14AL25055559602996AL75055559603047AL125055559603092AL175055559605225AL1450555596051955055559605195
15AL35055559603009AL85055559603054AL135055559605188AL185055559610267AL1550555596052015055559605201
16AL45055559603016AL95055559603061AL145055559605195AL195055559610274AL16 5055559605218
17AL55055559603023AL105055559603078AL155055559605201AL205055559610281AL17 5055559605225
18CRAFT COTTON3PLY5060019090312BLEND 25060019095614Toyball5060019095621AL18 5055559610267
19ECRU5060019092026AL19 5055559610274
20BLEACH5060019092033AL20 5055559610281
21BABY 4PLY 100gToyball 5060019095621
22BY15060019090220BY45060019090251BY85060019090299BY115055559610670
23BY25060019090237BY55060019090268BY95060019090305BY125055559610687
24BY35060019090244BY65060019090275BY105055559610663
25BABY 4PLY CONE
264BY150600190904114BY450600190904424BY850600190904804BY125055559624370
274BY250600190904284BY550600190904594BY95060019090497
284BY350600190904354BY650600190904664BY115055559624363
29BABY ARAN
30BA15060019090008BA45060019090022BA85060019090053BA125055559630548
31BA25060019090015BA55060019090039BA95060019090060
32BA35060019098349BA65060019090046BA115055559630531
33BABY DK 100g
34BB15060019090091BB45060019090121BB85060019090169BB125055559610656
35BB25060019090107BB55060019090138BB95060019090176
36BB35060019090114BB65060019090145BB115055559610632
37BABY DK 400g
384BB150600190903294BB450600190903504BB850600190903984BB125055559624356
394BB250600190903364BB550600190903674BB95060019090404
404BB350600190903434BB650600190903744BB115055559624349
41BABY MARBLE DK
42BM15060019097007BM105060019099568BM245055559606321BM335055559612261
43BM25060019097014BM125060019099582BM255055559606338BM345055559612278
44BM35060019097021BM135060019099599BM265055559606345BM355055559612285
45BM45060019097038BM165055559061472BM275055559609179BM365055559623724
46BM55060019097045BM195055559604488BM285055559609186BM375055559623731
47BM65060019097137BM205055559604495BM295055559609193BM385055559623748
48BM75060019097144BM215055559604501BM305055559610328BM395055559623755
49BM85060019097151BM225055559604518BM315055559610335BM405055559631408
50BM95060019097168BM235055559606314BM325055559610342BM415055559631415
51BABY SHIMMER DK
52BS15060019090503BS45060019090534BS85060019090565BABY SHIMMER 4PLY
53BS25060019090527BS55060019090541BS95060019090572BYS45060019090602
54BS35060019094143BS65060019090558
55BABY TWINKLE
56BT15055559603160BT45055559603191BT75055559603221
57BT25055559603177BT55055559603207BT85055559613145
58BT35055559603184BT65055559603214BT95055559613152
59BABY TWINKLE PRINT
60BTP15055559606758BTP95055559607304BTP205055559625384BTP285055559629047
61BTP25055559606765BTP105055559607878BTP215055559625391BTP295055559629054
62BTP35055559606772BTP115055559607885BTP225055559625407BTP305055559629061
63BTP45055559606789BTP125055559607892BTP235055559625414BTP315055559629078
64BTP55055559606796BTP135055559608561BTP245055559625421BTP325055559631118
65BTP65055559607274BTP145055559608578BTP255055559625438BTP335055559631125
66BTP75055559607281BTP155055559608585BTP265055559625445BTP345055559631132
67BTP85055559607298NEW PRINT - RELAUNCHEDBTP275055559625452
68BABY VELVET
69VT015055559628576VT035055559628590VT055055559628613VT07505055559628637
70VT025055559628583VT045055559628606VT065055559628620
BARCODE MASTER
Cell Formulas
RangeFormula
K4K4=IFERROR(OFFSET(A1,MATCH(J4,A$2:A$358,0),1),"")&IFERROR(OFFSET(A1,MATCH(J4,C$2:C$358,0),3),"")&IFERROR(OFFSET(A1,MATCH(J4,E$2:E$358,0),5),"")&IFERROR(OFFSET(A1,MATCH(J4,G$2:G$358,0),7),"")
K5:K21K5=IFERROR(OFFSET(A2,MATCH(J5,A3:A359,0),1),"")&IFERROR(OFFSET(A2,MATCH(J5,C3:C359,0),3),"")&IFERROR(OFFSET(A2,MATCH(J5,E3:E359,0),5),"")&IFERROR(OFFSET(A2,MATCH(J5,G3:G359,0),7),"")
 
Upvote 0
As formula posted - which is Volatile

Wheres PT13 ???
you can add an IFERROR if requured

Book7
ABCDEFGHIJKLM
1MASTER Barcode List
2Actual returned from code
3Supplier CodeEANSupplier CodeEANExpected Return Value
4J15055559602415J75055559602477J135055559610120J195055559631316BY150600190902205060019090220TRUE
5J25055559602422J85055559602484J145055559610137J205055559631323BY250600190902375060019090237TRUE
6J35055559602439J95055559602491J155055559610144J215055559631330BY350600190902445060019090244TRUE
7J45055559602446J105055559602507J165055559610151J225055559631347PT13#VALUE!5055559623847#VALUE!
8J55055559602453J115055559602514J175055559612322J235055559631354BY450600190902515060019090251TRUE
9J65055559602460J125055559602521J185055559612339BY550600190902685060019090268TRUE
10BY650600190902755060019090275TRUE
11AL1150555596030855055559603085TRUE
12AZTECAL1250555596030925055559603092TRUE
13AL15055559602989AL65055559603030AL115055559603085AL165055559605218AL1350555596051885055559605188TRUE
14AL25055559602996AL75055559603047AL125055559603092AL175055559605225AL1450555596051955055559605195TRUE
15AL35055559603009AL85055559603054AL135055559605188AL185055559610267AL1550555596052015055559605201TRUE
16AL45055559603016AL95055559603061AL145055559605195AL195055559610274AL1650555596052185055559605218TRUE
17AL55055559603023AL105055559603078AL155055559605201AL205055559610281AL1750555596052255055559605225TRUE
18CRAFT COTTON3PLY5060019090312BLEND 25060019095614Toyball5060019095621AL1850555596102675055559610267TRUE
19ECRU5060019092026AL1950555596102745055559610274TRUE
20BLEACH5060019092033AL2050555596102815055559610281TRUE
21BABY 4PLY 100gToyball50600190956215060019095621TRUE
22BY15060019090220BY45060019090251BY85060019090299BY115055559610670
23BY25060019090237BY55060019090268BY95060019090305BY125055559610687
24BY35060019090244BY65060019090275BY105055559610663
25BABY 4PLY CONE
264BY150600190904114BY450600190904424BY850600190904804BY125055559624370
274BY250600190904284BY550600190904594BY95060019090497
284BY350600190904354BY650600190904664BY115055559624363
29BABY ARAN
30BA15060019090008BA45060019090022BA85060019090053BA125055559630548
31BA25060019090015BA55060019090039BA95060019090060
32BA35060019098349BA65060019090046BA115055559630531
33BABY DK 100g
34BB15060019090091BB45060019090121BB85060019090169BB125055559610656
35BB25060019090107BB55060019090138BB95060019090176
36BB35060019090114BB65060019090145BB115055559610632
37BABY DK 400g
384BB150600190903294BB450600190903504BB850600190903984BB125055559624356
394BB250600190903364BB550600190903674BB95060019090404
404BB350600190903434BB650600190903744BB115055559624349
41BABY MARBLE DK
42BM15060019097007BM105060019099568BM245055559606321BM335055559612261
43BM25060019097014BM125060019099582BM255055559606338BM345055559612278
44BM35060019097021BM135060019099599BM265055559606345BM355055559612285
45BM45060019097038BM165055559061472BM275055559609179BM365055559623724
46BM55060019097045BM195055559604488BM285055559609186BM375055559623731
47BM65060019097137BM205055559604495BM295055559609193BM385055559623748
48BM75060019097144BM215055559604501BM305055559610328BM395055559623755
49BM85060019097151BM225055559604518BM315055559610335BM405055559631408
50BM95060019097168BM235055559606314BM325055559610342BM415055559631415
51BABY SHIMMER DK
52BS15060019090503BS45060019090534BS85060019090565BABY SHIMMER 4PLY
53BS25060019090527BS55060019090541BS95060019090572BYS45060019090602
54BS35060019094143BS65060019090558
55BABY TWINKLE
56BT15055559603160BT45055559603191BT75055559603221
57BT25055559603177BT55055559603207BT85055559613145
58BT35055559603184BT65055559603214BT95055559613152
59BABY TWINKLE PRINT
60BTP15055559606758BTP95055559607304BTP205055559625384BTP285055559629047
61BTP25055559606765BTP105055559607878BTP215055559625391BTP295055559629054
62BTP35055559606772BTP115055559607885BTP225055559625407BTP305055559629061
63BTP45055559606789BTP125055559607892BTP235055559625414BTP315055559629078
64BTP55055559606796BTP135055559608561BTP245055559625421BTP325055559631118
65BTP65055559607274BTP145055559608578BTP255055559625438BTP335055559631125
66BTP75055559607281BTP155055559608585BTP265055559625445BTP345055559631132
67BTP85055559607298NEW PRINT - RELAUNCHEDBTP275055559625452
68BABY VELVET
69VT015055559628576VT035055559628590VT055055559628613VT07505055559628637
70VT025055559628583VT045055559628606VT065055559628620
71
72
Sheet1
Cell Formulas
RangeFormula
K4:K21K4=INDIRECT(ADDRESS(MIN(IF($A$4:$H$100=J4,ROW($A$4:$H$100))),MIN(IF($A$4:$H$100=J4,COLUMN($A$4:$H$100)+1))))
M4:M21M4=K4=L4
 
Upvote 0
The problem is you need to change all the references to A1 into A$1 before you copy it down, you also need the $ in the references to the array. so put this in K4 and copy it down:
Excel Formula:
=IFERROR(OFFSET(A$1,MATCH(J4,A$2:A$358,0),1),"")&IFERROR(OFFSET(A$1,MATCH(J4,C$2:C$358,0),3),"")&IFERROR(OFFSET(A$1,MATCH(J4,E$2:E$358,0),5),"")&IFERROR(OFFSET(A$1,MATCH(J4,G$2:G$358,0),7),"")
 
Upvote 0
I think there may be some issues in the code.. I was trying to Figure out where the issue is but think I'm lost

JCB Barcode List Customer 02.12.21.xls
ABCDEFGHIJKL
1MASTER Barcode List
2Actual returned from code
3Supplier CodeEANSupplier CodeEANExpected Return Value
4J15055559602415J75055559602477J135055559610120J195055559631316BY150600190902205060019090220
5J25055559602422J85055559602484J145055559610137J205055559631323BY250600190902375060019090237
6J35055559602439J95055559602491J155055559610144J215055559631330BY350600190902445060019090244
7J45055559602446J105055559602507J165055559610151J225055559631347PT1350555596238475055559623847
8J55055559602453J115055559602514J175055559612322J235055559631354BY450600190902515060019090251
9J65055559602460J125055559602521J185055559612339BY550600190902685060019090268
10BY650600190902755060019090275
11AL1150555596030855055559603085
12AZTECAL1250555596030925055559603092
13AL15055559602989AL65055559603030AL115055559603085AL165055559605218AL1350555596051885055559605188
14AL25055559602996AL75055559603047AL125055559603092AL175055559605225AL1450555596051955055559605195
15AL35055559603009AL85055559603054AL135055559605188AL185055559610267AL1550555596052015055559605201
16AL45055559603016AL95055559603061AL145055559605195AL195055559610274AL16 5055559605218
17AL55055559603023AL105055559603078AL155055559605201AL205055559610281AL17 5055559605225
18CRAFT COTTON3PLY5060019090312BLEND 25060019095614Toyball5060019095621AL18 5055559610267
19ECRU5060019092026AL19 5055559610274
20BLEACH5060019092033AL20 5055559610281
21BABY 4PLY 100gToyball 5060019095621
22BY15060019090220BY45060019090251BY85060019090299BY115055559610670
23BY25060019090237BY55060019090268BY95060019090305BY125055559610687
24BY35060019090244BY65060019090275BY105055559610663
25BABY 4PLY CONE
264BY150600190904114BY450600190904424BY850600190904804BY125055559624370
274BY250600190904284BY550600190904594BY95060019090497
284BY350600190904354BY650600190904664BY115055559624363
29BABY ARAN
30BA15060019090008BA45060019090022BA85060019090053BA125055559630548
31BA25060019090015BA55060019090039BA95060019090060
32BA35060019098349BA65060019090046BA115055559630531
33BABY DK 100g
34BB15060019090091BB45060019090121BB85060019090169BB125055559610656
35BB25060019090107BB55060019090138BB95060019090176
36BB35060019090114BB65060019090145BB115055559610632
37BABY DK 400g
384BB150600190903294BB450600190903504BB850600190903984BB125055559624356
394BB250600190903364BB550600190903674BB95060019090404
404BB350600190903434BB650600190903744BB115055559624349
41BABY MARBLE DK
42BM15060019097007BM105060019099568BM245055559606321BM335055559612261
43BM25060019097014BM125060019099582BM255055559606338BM345055559612278
44BM35060019097021BM135060019099599BM265055559606345BM355055559612285
45BM45060019097038BM165055559061472BM275055559609179BM365055559623724
46BM55060019097045BM195055559604488BM285055559609186BM375055559623731
47BM65060019097137BM205055559604495BM295055559609193BM385055559623748
48BM75060019097144BM215055559604501BM305055559610328BM395055559623755
49BM85060019097151BM225055559604518BM315055559610335BM405055559631408
50BM95060019097168BM235055559606314BM325055559610342BM415055559631415
51BABY SHIMMER DK
52BS15060019090503BS45060019090534BS85060019090565BABY SHIMMER 4PLY
53BS25060019090527BS55060019090541BS95060019090572BYS45060019090602
54BS35060019094143BS65060019090558
55BABY TWINKLE
56BT15055559603160BT45055559603191BT75055559603221
57BT25055559603177BT55055559603207BT85055559613145
58BT35055559603184BT65055559603214BT95055559613152
59BABY TWINKLE PRINT
60BTP15055559606758BTP95055559607304BTP205055559625384BTP285055559629047
61BTP25055559606765BTP105055559607878BTP215055559625391BTP295055559629054
62BTP35055559606772BTP115055559607885BTP225055559625407BTP305055559629061
63BTP45055559606789BTP125055559607892BTP235055559625414BTP315055559629078
64BTP55055559606796BTP135055559608561BTP245055559625421BTP325055559631118
65BTP65055559607274BTP145055559608578BTP255055559625438BTP335055559631125
66BTP75055559607281BTP155055559608585BTP265055559625445BTP345055559631132
67BTP85055559607298NEW PRINT - RELAUNCHEDBTP275055559625452
68BABY VELVET
69VT015055559628576VT035055559628590VT055055559628613VT07505055559628637
70VT025055559628583VT045055559628606VT065055559628620
BARCODE MASTER
Cell Formulas
RangeFormula
K4K4=IFERROR(OFFSET(A1,MATCH(J4,A$2:A$358,0),1),"")&IFERROR(OFFSET(A1,MATCH(J4,C$2:C$358,0),3),"")&IFERROR(OFFSET(A1,MATCH(J4,E$2:E$358,0),5),"")&IFERROR(OFFSET(A1,MATCH(J4,G$2:G$358,0),7),"")
K5:K21K5=IFERROR(OFFSET(A2,MATCH(J5,A3:A359,0),1),"")&IFERROR(OFFSET(A2,MATCH(J5,C3:C359,0),3),"")&IFERROR(OFFSET(A2,MATCH(J5,E3:E359,0),5),"")&IFERROR(OFFSET(A2,MATCH(J5,G3:G359,0),7),"")
Ok I see. The P13 is actually another part fo the document It was too large to share
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,174
Members
452,615
Latest member
bogeys2birdies

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