 New Contributor

# Need to calculate based on values from two separate drop down Lists

list of 16 cars, 16 brands and 16 different prices. I have a main sheet with my data, a second sheet with the table containing the drop down lists. My formula spills. I cannot for the life of me figure out what I'm missing. I've tried so many

=VLOOKUP('Main Sheet'!A4:A20,[@[From ]]&'Main Sheet'!A4:Q4,[@To],'Main Sheet'!B5:B20)

this is my latest. Anyone recognize what I'm missing? I know once I see it, I'll have that AHA moment

7 Replies

# Re: Need to calculate based on values from two separate drop down Lists

Without seeing your actual workbook, it's hard to be sure. I do notice that the first argument in your VLOOKUP formula is itself an array, and my own suspicion would be that that might be the problem. Usually one uses a single cell as the first argument.

If you were to post your actual sheet, we (I and others) could take a look at it. Just make sure it's not got any confidential info on it

# Re: Need to calculate based on values from two separate drop down Lists

Lookup value here is an array, formula returns an array for which is not enough space in one cell of the table, thus #SPILL error What other parameters mean is also absolutely unclear (second one is value instead of range, etc)

# Re: Need to calculate based on values from two separate drop down Lists

@mathetes just getting laptop back thanks so much for response. I've attached sheet

# Re: Need to calculate based on values from two separate drop down Lists

That could be

``````=IFNA(INDEX('Main Sheet'!\$A\$4:\$Q\$20,
MATCH([@[From ]],  'Main Sheet'!\$A\$4:\$A\$20,0),
MATCH([@To],'Main Sheet'!\$A\$4:\$Q\$4,0)),0)``````

# Re: Need to calculate based on values from two separate drop down Lists

@Sergei Baklanhas given you the formula that handles your initial request. I've tweaked the spreadsheet just a bit more and suggest you not "hard-code" the mileage rate into the formula, as you had it. Instead, create a named range where that rate is called "MileageRate" and then your formulas will just refer to that term. That way, next year, when the rate gets changed (or after you've exceeded the 5,000 Km limit, the rate can be changed at the level of that little table rather than editing each formula.

# Re: Need to calculate based on values from two separate drop down Lists

You guys are the absolute best! I didnt even try the match thanks so much for you help. Now I'll never forget it

# Re: Need to calculate based on values from two separate drop down Lists

You are welcome.

If continue @mathetes idea, you may name range with Mileage Matrix let say as MileageMatrix, when formula could be

``````=IFNA(INDEX( MileageMatrix,
MATCH([@[From ]],INDEX(MileageMatrix,0,1),0),
MATCH([@To],INDEX(MileageMatrix,1,0),0)
),0)``````