View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
VivienW VivienW is offline
external usenet poster
 
Posts: 11
Default VLOOKUP within VLOOKUP

Thank you so much!! I can't tell you how long I've been playing around with
this. :)
--
Cheers, V


"Sheeloo" wrote:

I think the mistake is in using D12 as the lookup value in the second one...
Try
=IF(D12="P",VLOOKUP(C12,PETROL2,2),IF(D12="D",VLOO KUP(C12,PETROL2,3)))

i.e. both VLOOKUP should have VLOOKUP(C12,PETROL2, followed by either 2 or
3...
"VivienW" wrote:

Hello, I'm using VLOOKUP tables and have a problem entering a
formula/function. For example, the data I'm using concerns engine capacity
and fuel types; this data is laid out as follows

Capacity Petrol Diesel (This table is named 'PETROL2 and starts in cell A3)
0 £0.30 £0.20
1100 £0.40 £0.30
1300 £0.42 £0.32
1600 £0.45 £0.35
2000 £0.47 £0.37

Miles Capacity Type Cost (starts in B12)
10 1100 P £0.40 (Formula:
=IF(D12="P",VLOOKUP(C12,PETROL2,2),IF(D12="D",VLOO KUP(D12,PETROL2,3)))
200 1297 P £0.40
300 1100 D #N/A
50 2000 P £0.47
100 1600 D #N/A

What I need is a formula that will return the total cost of the Diesel
entries. As you can see the Petrol entries are there! Please help, I really
can't see where I'm going wrong.
--
Cheers, V