SOLVED

Combining IF and INDEX functions

%3CLINGO-SUB%20id%3D%22lingo-sub-137836%22%20slang%3D%22en-US%22%3ECombining%20IF%20and%20INDEX%20functions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-137836%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20trying%20to%20find%20a%20formula%20that%20will%20allow%20me%20to%20display%20multiple%20fields%20of%20data%20when%20a%20specific%20value%20(a%20product%20SKU)%20is%20entered%20into%20a%20cell.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20managed%20to%20get%20this%20to%20work%20with%20a%20VLOOKUP%20formula%2C%20whereby%20I%20could%20enter%20the%20SKU%20into%20one%20cell%2C%20and%20have%20the%20following%20cells%20display%20various%20values%2C%20such%20as%20the%20brand%2C%20item%2C%20Net%20cost%2C%20VAT%2C%20gross%20price%20and%20so%20on.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHowever%2C%20want%20to%20use%20an%20INDEX%20formula%20instead%20so%20that%20if%20I%20edit%20the%20reference%20table%20then%20it%20won't%20affect%20the%20returned%20results.%20I%20also%20want%20to%20be%20able%20to%20specify%20which%20columns%2Fvalue%20are%20returned%20(for%20example%2C%20I%20don't%20necessarily%20want%20to%20display%20the%20Net%20cost%20of%20a%20product.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFrom%20what%20I%20can%20tell%2C%20VLOOKUP%20only%20allows%20for%20either%20a%20single%26nbsp%3Bcolumn's%20value%20to%20be%20returned%2C%20or%20all%20of%20the%26nbsp%3Bspecified%20columns%20from%20left%20to%20right%2C%20with%20no%20option%20to%20omit%20any.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20think%20I%20need%20a%20combination%20of%20IF%20and%20INDEX%2C%20whereby%20IF%20the%20value%20matches%20an%20SKU%20in%2C%20say%2C%20Column%20A%2C%20then%20values%20relating%20to%20that%20product%20code%20are%20returned.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20thought%20I%20was%20getting%20there%20with%20the%20following%20formula%20(albeit%20only%20being%20able%20to%20return%20one%20value)%3A%3C%2FP%3E%0A%3CP%3E%3DIF((%3CFONT%20color%3D%22%23000000%22%3EP%3C%2FFONT%3E%3CFONT%20color%3D%22%23FF0000%22%3E15%3C%2FFONT%3E%3D%3CFONT%20color%3D%22%230000FF%22%3ED%3AD%3C%2FFONT%3E)%2CINDEX(%24E%2415%3A%24O%24105%2C0%2C%3CFONT%20color%3D%22%23339966%22%3E2%3C%2FFONT%3E)).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%230000FF%22%3ED%3C%2FFONT%3E%26nbsp%3Bis%20the%20worksheet%20column%20in%20which%20all%20of%20the%20SKUs%20are%20listed.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20worked%20if%20I%20entered%20the%20relevant%20SKU%20on%20row%20%3CFONT%20color%3D%22%23FF0000%22%3E15%3C%2FFONT%3E%2C%20as%20it%20returned%20the%20correct%20gross%20price%20that%20was%20displayed%20in%20column%20%3CFONT%20color%3D%22%23339966%22%3E2%20%3CFONT%20color%3D%22%23000000%22%3Eof%20the%20reference%20table%3C%2FFONT%3E%3C%2FFONT%3E%3CFONT%20color%3D%22%23000000%22%3E.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHowever%2C%20a%20value%20is%20only%20returned%20if%20the%20SKU%20is%20that%20of%20row%2015%2C%20otherwise%20it%20displays%20'FALSE'%20if%20I%20try%20and%20search%20prices%20using%20any%20other%20any%20other%20SKU%20input.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20has%20been%20driving%20me%20mad%20for%20hours%2C%20so%20I'd%20be%20hugely%20grateful%20if%20anyone%20is%20able%20to%20enlighten%20me.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThank%20you.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-137836%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20%26amp%3B%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ENeed%20Help%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-139468%22%20slang%3D%22en-US%22%3ERe%3A%20Combining%20IF%20and%20INDEX%20functions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-139468%22%20slang%3D%22en-US%22%3ESergei%2C%20you%20are%20a%20genius!%3CBR%20%2F%3E%3CBR%20%2F%3EIt%20took%20me%20a%20while%20to%20get%20it%20to%20work%20as%20I've%20not%20used%20Excel%20Tables%20before%20and%20didn't%20realise%20right%20away%20that%20I%20had%20to%20name%20the%20table%20in%20the%20settings%20as%20well.%20But%20it%20now%20all%20works%20and%20does%20exactly%20what%20I%20want%20it%20to%20do%2C%20and%20adapts%20if%20I%20add%20rows%20into%20my%20source%20table%20as%20well.%20%3CBR%20%2F%3E%3CBR%20%2F%3EThis%20is%20going%20to%20make%20my%20life%20so%20much%20easier%20in%20future%20when%20dealing%20with%20stock%20lists.%20I%20can't%20thank%20you%20enough%20for%20your%20help%2C%20it%20really%20is%20appreciated.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-139241%22%20slang%3D%22en-US%22%3ERe%3A%20Combining%20IF%20and%20INDEX%20functions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-139241%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Peter%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20a%20variant%20I%20may%20suggest%20to%20form%20your%20data%20in%20Excel%20Tables%20(available%20from%20Excel%202007).%20To%20convert%20the%20range%20which%20has%20table%20structure%20(i.e.%20headers%20and%20rows%20with%20data)%20just%20stay%20somewhere%20within%20the%20range%20and%20press%20Ctrl%2BT.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20your%20sample%20tables%20looks%20like%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20841px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F25998i136EA0CEE0AC3672%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22LookupTables.JPG%22%20title%3D%22LookupTables.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20LookupTable1%20in%20first%20row%20in%20Brand%20column%20enter%20the%20formula%3C%2FP%3E%0A%3CPRE%3E%3DVLOOKUP(LookupTable1%5B%40%5BSKU%5D%3A%5BSKU%5D%5D%2CReferenceTable%2CMATCH(LookupTable1%5B%5B%23Headers%5D%2C%5BBrand%5D%5D%2CReferenceTable%5B%23Headers%5D%2C0)%2CFALSE)%3C%2FPRE%3E%0A%3CP%3EFirst%20part%3C%2FP%3E%0A%3CPRE%3ELookupTable1%5B%40%5BSKU%5D%3A%5BSKU%5D%5D%3C%2FPRE%3E%0A%3CP%3Eis%20kind%20of%20absolute%20reference%20which%20fixes%20your%20SKU%20column%20when%20you%20copy%20the%20formula%20to%20the%20right.%3C%2FP%3E%0A%3CP%3EMATCH%20returns%20the%20index%20of%20the%20column%20in%20ReferenceTable%20which%20has%20the%20same%20header%20as%20in%20LookupTable.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20drag%20the%20formula%20to%20the%20right%20with%20Copy%20cells%20(not%20copy%2Fpaste)%20till%20end%20of%20your%20table.%3C%2FP%3E%0A%3CP%3ESimilar%20for%20the%20second%20lookup%20table.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThat's%20all.%20No%20need%20to%20copy%2Fpaste%20and%2For%20change%20your%20formulas%20when%20you%20expand%20your%20Reference%20table.%20Adding%20SKU%20into%20lookup%20table%20you%20only%20need%20to%20enter%20SKU%20into%20the%20next%20from%20the%20bottom%20of%20the%20lookup%20table%20line.%20The%20table%20will%20auto%20expands%20and%20formulas%20in%20next%20columns%20auto-fills%20returning%20you%20values%20from%20the%20Reference%20table.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20variant%20INDEX%2FMATCH%20could%20be%20used%2C%20see%20LookupTable3%20and%26nbsp%3B%3CSPAN%3ELookupTable4.%20Same%20result%2C%20only%20the%20formula%20above%20looks%20like%3C%2FSPAN%3E%3C%2FP%3E%0A%3CPRE%3E%3DINDEX(ReferenceTable%2CMATCH(LookupTable3%5B%40%5BSKU%5D%3A%5BSKU%5D%5D%2CReferenceTable%5B%5BSKU%5D%3A%5BSKU%5D%5D%2C0)%2CMATCH(LookupTable3%5B%5B%23Headers%5D%2C%5BBrand%5D%5D%2CReferenceTable%5B%23Headers%5D%2C0))%3C%2FPRE%3E%0A%3CP%3E%3CSPAN%3EPlease%20see%20attached%20file%20with%20the%20sample.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-139216%22%20slang%3D%22en-US%22%3ERe%3A%20Combining%20IF%20and%20INDEX%20functions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-139216%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Sergei%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI've%20attached%20an%20example%20workbook%20which%20hopefully%20illustrates%20what%20I'm%20trying%20to%20achieve.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMy%20Reference%20Table%20contains%20a%20list%20of%20products%20along%20with%20associated%20costs%2C%20all%20indexed%20with%20an%20SKU.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELookup%20Table%201%20contains%20a%20VLOOKUP%20formula%20in%20the%20top%20row%20that%20allows%20me%20to%20enter%20an%20SKU%20and%20then%20display%20the%20corresponding%20data%20from%20the%20Reference%20Table.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThat%20essentially%20does%20what%20I%20want%20it%20to%20do%2C%20with%20the%20following%20limitiations%3A%3C%2FP%3E%0A%3CP%3E1)%20If%20I%20add%20any%20new%20rows%20in%20the%20Reference%20Table%20when%20I%20buy%20in%20more%20products%20then%20it%20will%20break%20my%20VLOOKUP%20formula%20because%20the%20%3CI%3ETable_array%3C%2FI%3E%26nbsp%3Bwill%20change%20and%20the%20formula%20doesn't%20adapt.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E2)%20For%20Lookup%20Table%202%2C%20I%20only%20want%20to%20display%20select%20columns%20from%20the%20Reference%20Table%20(it%20will%20be%20for%20distribution%20to%20retailers%20and%20I%20don't%20want%20them%20to%20see%20my%20Net%20Costs).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E3)%20The%20VLOOKUP%20formula%20obviously%20uses%20absolute%20references%20so%20that%20when%20I%20drag%20the%20formula%20horizontally%20to%20copy%20it%20into%20other%20columns%20it%20retains%20the%20Lookup_value%20and%20Table_array%20references.%20However%2C%20I'm%20unable%20to%20copy%20the%20working%20formula%20into%20the%20rows%20below%20as%20it%20just%20takes%20with%20it%20the%20values%20already%20in%20the%20cells.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESo%2C%20what%20I%20need%20is%20a%20formula%20that%20will%20allow%20me%20to%20perform%20a%20look-up%20function%20that%20will%20adapt%20when%20I%20make%20changes%20to%20the%20Reference%20Table%2C%20and%20allow%20me%20to%20choose%20which%20columns%20to%20draw%20data%20from%20and%20display.%20I%20also%20need%20to%20work%20out%20how%20to%20copy%20that%20formula%20effectively%20into%20subsequent%20rows.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI've%20read%20that%20INDEX%20is%20better%20than%20VLOOKUP%20as%20the%20formula%20won't%20break%20when%20amending%20the%20reference%20Table_array%2C%20but%20I%20can%20only%20work%20out%20how%20to%20make%20INDEX%26nbsp%3Breturn%20data%20in%20one%20cell%20when%20I%20specify%20what%20to%20look%20for%2C%20which%20is%20effectively%20a%20%3D'%3CEM%3Ecell%3C%2FEM%3E'%20formula.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20don't%20think%20I%20need%20a%20MATCH%20formula%20because%20I%20not%20asking%20it%20to%20search%20for%20various%20matches%2C%20I%20simply%20need%20to%20be%20able%20to%20enter%20a%20product%20code%20in%20one%20cell%2C%20and%20display%20corresponding%20data%20from%20the%20row%20associated%20with%20that%20product%20code.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20hope%20that%20makes%20sense!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-138443%22%20slang%3D%22en-US%22%3ERe%3A%20Combining%20IF%20and%20INDEX%20functions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-138443%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Peter%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYes%2C%20with%20workbook%20it'll%20be%20easier.%20Just%20a%20guess%2C%20perhaps%20instead%20of%20IF(P15%3DD%3AD%2C%20in%20your%20formula%20it%20shall%20be%3C%2FP%3E%0A%3CPRE%3E%3DIF(IFNA(MATCH(P15%2CD%3AD%2C0)%2C0)%2C...%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-138246%22%20slang%3D%22en-US%22%3ERe%3A%20Combining%20IF%20and%20INDEX%20functions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-138246%22%20slang%3D%22en-US%22%3EHi%20Detlef%2C%20thanks%20for%20your%20response.%20Yes%20I'll%20post%20an%20example%20workbook%20in%20a%20couple%20of%20days%2C%20I'm%20away%20skiing%20at%20the%20moment!%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-138245%22%20slang%3D%22en-US%22%3ERe%3A%20Combining%20IF%20and%20INDEX%20functions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-138245%22%20slang%3D%22en-US%22%3EHi%20Sergei%2C%20thank%20you%20for%20responding.%20I%20did%20look%20into%20INDEX%2FMATCH%20formulas%20but%20I%20don't%20think%20it%20does%20quite%20what%20I%20need%20it%20to.%20From%20what%20I%20can%20see%2C%20that%20formula%20doesn't%20seem%20to%20allow%20for%20a%20look-up%20function%2C%20unless%20I'm%20doing%20it%20wrong.%20I'll%20look%20into%20it%20again.%20Thank%20you.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-138237%22%20slang%3D%22en-US%22%3ERe%3A%20Combining%20IF%20and%20INDEX%20functions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-138237%22%20slang%3D%22en-US%22%3E%3CP%3EPeter%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ecould%20you%20provide%20an%20anonymized%20workbook%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-138233%22%20slang%3D%22en-US%22%3ERe%3A%20Combining%20IF%20and%20INDEX%20functions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-138233%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Peter%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20guess%20you%20don't%20need%20IF%20here%2C%20use%20INDEX%2FMATCH%20combination%20(e.g.%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fexceljet.net%2Fformula%2Fbasic-index-match-exact)%26nbsp%3B%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fexceljet.net%2Fformula%2Fbasic-index-match-exact)%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

I'm trying to find a formula that will allow me to display multiple fields of data when a specific value (a product SKU) is entered into a cell.

 

I managed to get this to work with a VLOOKUP formula, whereby I could enter the SKU into one cell, and have the following cells display various values, such as the brand, item, Net cost, VAT, gross price and so on.

 

However, want to use an INDEX formula instead so that if I edit the reference table then it won't affect the returned results. I also want to be able to specify which columns/value are returned (for example, I don't necessarily want to display the Net cost of a product.

 

From what I can tell, VLOOKUP only allows for either a single column's value to be returned, or all of the specified columns from left to right, with no option to omit any.

 

I think I need a combination of IF and INDEX, whereby IF the value matches an SKU in, say, Column A, then values relating to that product code are returned.

 

I thought I was getting there with the following formula (albeit only being able to return one value):

=IF((P15=D:D),INDEX($E$15:$O$105,0,2)).

 

D is the worksheet column in which all of the SKUs are listed.

 

This worked if I entered the relevant SKU on row 15, as it returned the correct gross price that was displayed in column 2 of the reference table.

 

However, a value is only returned if the SKU is that of row 15, otherwise it displays 'FALSE' if I try and search prices using any other any other SKU input.

 

This has been driving me mad for hours, so I'd be hugely grateful if anyone is able to enlighten me.

 

Thank you.

8 Replies
Highlighted

Hi Peter,

 

I guess you don't need IF here, use INDEX/MATCH combination (e.g. https://exceljet.net/formula/basic-index-match-exact) 

Highlighted

Peter,

 

could you provide an anonymized workbook?

 

Highlighted
Hi Sergei, thank you for responding. I did look into INDEX/MATCH formulas but I don't think it does quite what I need it to. From what I can see, that formula doesn't seem to allow for a look-up function, unless I'm doing it wrong. I'll look into it again. Thank you.
Highlighted
Hi Detlef, thanks for your response. Yes I'll post an example workbook in a couple of days, I'm away skiing at the moment!
Highlighted

Hi Peter,

 

Yes, with workbook it'll be easier. Just a guess, perhaps instead of IF(P15=D:D, in your formula it shall be

=IF(IFNA(MATCH(P15,D:D,0),0),...

 

Highlighted

Hi Sergei,

 

I've attached an example workbook which hopefully illustrates what I'm trying to achieve.

 

My Reference Table contains a list of products along with associated costs, all indexed with an SKU.

 

Lookup Table 1 contains a VLOOKUP formula in the top row that allows me to enter an SKU and then display the corresponding data from the Reference Table.

 

That essentially does what I want it to do, with the following limitiations:

1) If I add any new rows in the Reference Table when I buy in more products then it will break my VLOOKUP formula because the Table_array will change and the formula doesn't adapt.

 

2) For Lookup Table 2, I only want to display select columns from the Reference Table (it will be for distribution to retailers and I don't want them to see my Net Costs).

 

3) The VLOOKUP formula obviously uses absolute references so that when I drag the formula horizontally to copy it into other columns it retains the Lookup_value and Table_array references. However, I'm unable to copy the working formula into the rows below as it just takes with it the values already in the cells.

 

So, what I need is a formula that will allow me to perform a look-up function that will adapt when I make changes to the Reference Table, and allow me to choose which columns to draw data from and display. I also need to work out how to copy that formula effectively into subsequent rows.

 

I've read that INDEX is better than VLOOKUP as the formula won't break when amending the reference Table_array, but I can only work out how to make INDEX return data in one cell when I specify what to look for, which is effectively a ='cell' formula.

 

I don't think I need a MATCH formula because I not asking it to search for various matches, I simply need to be able to enter a product code in one cell, and display corresponding data from the row associated with that product code.

 

I hope that makes sense!

Highlighted
Best Response confirmed by Peter Fleckney (Occasional Contributor)
Solution

Hi Peter,

 

As a variant I may suggest to form your data in Excel Tables (available from Excel 2007). To convert the range which has table structure (i.e. headers and rows with data) just stay somewhere within the range and press Ctrl+T.

 

For your sample tables looks like

LookupTables.JPG

 

In LookupTable1 in first row in Brand column enter the formula

=VLOOKUP(LookupTable1[@[SKU]:[SKU]],ReferenceTable,MATCH(LookupTable1[[#Headers],[Brand]],ReferenceTable[#Headers],0),FALSE)

First part

LookupTable1[@[SKU]:[SKU]]

is kind of absolute reference which fixes your SKU column when you copy the formula to the right.

MATCH returns the index of the column in ReferenceTable which has the same header as in LookupTable.

 

When drag the formula to the right with Copy cells (not copy/paste) till end of your table.

Similar for the second lookup table.

 

That's all. No need to copy/paste and/or change your formulas when you expand your Reference table. Adding SKU into lookup table you only need to enter SKU into the next from the bottom of the lookup table line. The table will auto expands and formulas in next columns auto-fills returning you values from the Reference table.

 

As variant INDEX/MATCH could be used, see LookupTable3 and LookupTable4. Same result, only the formula above looks like

=INDEX(ReferenceTable,MATCH(LookupTable3[@[SKU]:[SKU]],ReferenceTable[[SKU]:[SKU]],0),MATCH(LookupTable3[[#Headers],[Brand]],ReferenceTable[#Headers],0))

Please see attached file with the sample.

 

Highlighted
Sergei, you are a genius!

It took me a while to get it to work as I've not used Excel Tables before and didn't realise right away that I had to name the table in the settings as well. But it now all works and does exactly what I want it to do, and adapts if I add rows into my source table as well.

This is going to make my life so much easier in future when dealing with stock lists. I can't thank you enough for your help, it really is appreciated.