Referencing a value from a table

ddub25

Well-known Member
Joined
Jan 11, 2007
Messages
625
Office Version
  1. 2019
Platform
  1. Windows
__________DK____________DL______DM______DN
_______Date_________Date_______ $_______€
_______From_________To
19_____01/01/2011___31/01/2011__0.6671__0.8470
20_____01/02/2011___28/02/2011__0.6671__0.8470
21_____01/03/2011___31/03/2011__0.6148__0.8581
22_____01/04/2011___30/04/2011__0.6000__0.8500

I want to reference a value from the table according to certain conditions. (DK, DL, DM, DN are columns - sorry about the crude table)

For example, cell AE367 contains the date 21/03/2011 and cell D367 contains the "€" currency symbol. In this case I want the formula to be able to look at the table and see that the 21/03/2011 falls between the two dates on row 21 and the € column contains 0.8581 for this row. This is the value I want referenced.

I have tried this with VLOOKUP and HLOOKUP with no luck. Can anyone help. Thanks.

Dan
 
Last edited:

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Excel Workbook
ABCD
16DKDLDMDN
17DateDate$
18FromTo
191/1/20111/31/20110.66710.847
202/1/20112/28/20110.66710.847
213/1/20113/31/20110.61480.8581
224/1/20114/30/20110.60.85
Sheet2
Excel 2003
Excel Workbook
D
367
3680.8581
Sheet2
Excel 2003
Cell Formulas
RangeFormula
D368=SUMPRODUCT(--(A19:A22<=AE367),--(B19:B22>=AE367),(D19:D22))
 
Upvote 0
Thanks. The formula also needs to ask IF E367 contains a "€" sign or a "$". If it contains a "$" sign then take the value from column C (C21 = 0.6148). If it contains a "€" sign then take the value from column D (D21 = 0.8581).

How could this be incorporated?
 
Upvote 0
does this work
Excel Workbook
DE
367$
3680.61480.8581
Sheet1
Excel 2003
Cell Formulas
RangeFormula
D368=INDEX($DM$17:$DN$22,MATCH($AD$367,$DK$17:$DK$22),MATCH(D$367,$DM$17:$DN$17,0))
E368=INDEX($DM$17:$DN$22,MATCH($AD$367,$DK$17:$DK$22),MATCH(E$367,$DM$17:$DN$17,0))
 
Upvote 0
Here is your formula:
=INDEX($DM$17:$DN$22,MATCH($AD$367,$DK$17:$DK$22),MATCH(D$367,$DM$17:$DN$17,0))

It returns #N/A (maybe because in the last bracket you have $DM$17:$DN$17, when maybe it should be: $DM$17:$DN$22

I adapted it to:
=INDEX($DM$17:$DN$22,MATCH(AE367,$DK$17:$DK$22),MATCH(D367,$DM$17:$DN$22,0))

changing the last bracket to $DM$17:$DN$22, and instead of $AD$367, I now have AE367 (column AE is the one i want referenced).

However, the formula still returns #N/A.

This formula does not consider column DL (Date To) and would not be able to know if the date in column AE is between the dates in columns DK and DL would it?

The formula needs to;
1) look at AE367 and realise that it contains a date of 21/03/2011
2) look at D367 and realise that it contains the symbol "€"

From this it would need to look at the table and realise that the date of the 21/03/2011 falls between the dates on row 21 and the currency corresponds with the column D (euro's). Row 21, Column D (Cell D21 = 0.8581). This is value that the forumla should reference.

Can anyone help me with a formula that would do this? Thanks in advance.

Dan
 
Last edited:
Upvote 0
Here is your formula:
=INDEX($DM$17:$DN$22,MATCH($AD$367,$DK$17:$DK$22),MATCH(D$367,$DM$17:$DN$17,0))

It returns #N/A (maybe because in the last bracket you have $DM$17:$DN$17, when maybe it should be: $DM$17:$DN$22

I adapted it to:
=INDEX($DM$17:$DN$22,MATCH(AE367,$DK$17:$DK$22),MATCH(D367,$DM$17:$DN$22,0))

changing the last bracket to $DM$17:$DN$22, and instead of $AD$367, I now have AE367 (column AE is the one i want referenced).

However, the formula still returns #N/A.

This formula does not consider column DL (Date To) and would not be able to know if the date in column AE is between the dates in columns DK and DL would it?

The formula needs to;
1) look at AE367 and realise that it contains a date of 21/03/2011
2) look at D367 and realise that it contains the symbol "€"

From this it would need to look at the table and realise that the date of the 21/03/2011 falls between the dates on row 21 and the currency corresponds with the column D (euro's). Row 21, Column D (Cell D21 = 0.8581). This is value that the forumla should reference.

Can anyone help me with a formula that would do this? Thanks in advance.

Dan
This works for me...

=VLOOKUP(AE367,DK19:DN22,MATCH(D367,DK17:DN17,0))

Note that in my setup the "$" symbol equates to =CHAR(36) and the "€" symbol equates to =CHAR(128).
 
Upvote 0
Thanks, that works great. How could I get the result to return "--" if neither "€" or "$" are present in column D?
 
Upvote 0
=if(vlookup(ae367,dk19:dn22,match(d367,dk17:dn17,0))="","--",
vlookup(ae367,dk19:dn22,match(d367,dk17:dn17,0))
 
Upvote 0
Thanks, but it does not seem to give me "--" if D367 is empty. It just returns the usual #N/A as before. What i fully would like is for it to return "--" if D367 does not equal either "€" or "$". The formula does return the correct values though as with the previous formula.

=IF(VLOOKUP(AE367,$DK$19:$DN$75,MATCH(D367,$DK$17:$DN$17,0))="","--",VLOOKUP(AE367,$DK$19:$DN$75,MATCH(D367,$DK$17:$DN$17,0)))

Any more ideas? Thanks.

Dan
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,740
Members
452,940
Latest member
Lawrenceiow

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