IF Statement combined with vlookup and formula

dc4000

New Member
Joined
Jan 19, 2018
Messages
8
Hello,

This should be straightforward but ive drawn a blank.

We are given;

Sheet1:
Col B: range of currencies in this format. A sample list has been provided but there may be more so the formula has to be dynamic enough to allow for this.
Col C: Value is given but could be any given value
Col D: Requires formula to show the following. Depending on value from Col b then take this rate which can be sourced from Sheet2 and times the value in Col C by this amount. Rates need to be sourced for A1 = 30/09/2018

Sheet1[TABLE="width: 500"]
<tbody>[TR]
[TD][TABLE="width: 217"]
<colgroup><col span="2"><col></colgroup><tbody>[TR]
[TD]Ccy[/TD]
[TD]Value[/TD]
[TD]Value_Fx'd[/TD]
[/TR]
[TR]
[TD]GBP[/TD]
[TD="align: right"]1000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]GBP[/TD]
[TD="align: right"]2000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]GBP[/TD]
[TD="align: right"]3000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]USD[/TD]
[TD="align: right"]4000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]JPY[/TD]
[TD="align: right"]5000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]DKK[/TD]
[TD="align: right"]6000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]SEK[/TD]
[TD="align: right"]7000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]BRL[/TD]
[TD="align: right"]8000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]GBP[/TD]
[TD="align: right"]9000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]EUR[/TD]
[TD="align: right"]10000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]HKD[/TD]
[TD="align: right"]11000[/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Sheet2
[TABLE="width: 500"]
<tbody>[TR]
[TD][TABLE="width: 523"]
<colgroup><col><col span="7"></colgroup><tbody>[TR]
[TD][/TD]
[TD]FX_Rates[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]USDJPY[/TD]
[TD]USDGBP[/TD]
[TD]USDHKD[/TD]
[TD]USDEUR[/TD]
[TD]USDSEK[/TD]
[TD]USDDKK[/TD]
[TD]USDBRL[/TD]
[/TR]
[TR]
[TD="align: right"]31/08/2018[/TD]
[TD="align: right"]110.05[/TD]
[TD="align: right"]0.575[/TD]
[TD="align: right"]14[/TD]
[TD="align: right"]1.05[/TD]
[TD="align: right"]6.5[/TD]
[TD="align: right"]8.55[/TD]
[TD="align: right"]2.25[/TD]
[/TR]
[TR]
[TD="align: right"]30/09/2018[/TD]
[TD="align: right"]112.05[/TD]
[TD="align: right"]0.675[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]1.15[/TD]
[TD="align: right"]7.5[/TD]
[TD="align: right"]9.55[/TD]
[TD="align: right"]3.25[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Like this?

=IF(B2="USD",C2,INDEX(Sheet2!$B$2:$H$3,MATCH($A$1,Sheet2!$A$2:$A$3,0),MATCH("USD"&B2,Sheet2!$B$1:$H$1,0))*C2)

*Assuming Sheet2 has the headers in row 1 and dates in column A
 
Last edited:
Upvote 0
On sheet1 with the following result as only the column with "USD" gave the required result. However what about the other currencies as these are not populating. The tables below are like-for-like as how the data is displayed. A1 = A1 of the excel worksheet


[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]A1[/TD]
[TD]Ccy[/TD]
[TD]Value[/TD]
[TD]Value Fx'd[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]GBP[/TD]
[TD]1000[/TD]
[TD]#N/A
=IF(B2="USD",C2,INDEX(Sheet2!$B$2:$H$4,MATCH($B$2,Sheet2!$A$2:$A$3,0),MATCH("USD"&B2,Sheet2!$B$2:$H$2,0))*C2)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]GBP[/TD]
[TD]1000[/TD]
[TD]#N/A
=IF(B2="USD",C2,INDEX(Sheet2!$B$2:$H$4,MATCH($B$2,Sheet2!$A$2:$A$3,0),MATCH("USD"&B2,Sheet2!$B$2:$H$2,0))*C2)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]GBP[/TD]
[TD]1000[/TD]
[TD]#N/A
=IF(B2="USD",C2,INDEX(Sheet2!$B$2:$H$4,MATCH($B$2,Sheet2!$A$2:$A$3,0),MATCH("USD"&B2,Sheet2!$B$2:$H$2,0))*C2)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]USD[/TD]
[TD]1000[/TD]
[TD]1000 (USING FORMULA BELOW)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]JPY[/TD]
[TD]1000[/TD]
[TD]#N/A
=IF(B2="USD",C2,INDEX(Sheet2!$B$2:$H$4,MATCH($B$2,Sheet2!$A$2:$A$3,0),MATCH("USD"&B2,Sheet2!$B$2:$H$2,0))*C2)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]DKK[/TD]
[TD]1000[/TD]
[TD]#N/A
=IF(B2="USD",C2,INDEX(Sheet2!$B$2:$H$4,MATCH($B$2,Sheet2!$A$2:$A$3,0),MATCH("USD"&B2,Sheet2!$B$2:$H$2,0))*C2)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]SEK[/TD]
[TD]100[/TD]
[TD]#N/A
=IF(B2="USD",C2,INDEX(Sheet2!$B$2:$H$4,MATCH($B$2,Sheet2!$A$2:$A$3,0),MATCH("USD"&B2,Sheet2!$B$2:$H$2,0))*C2)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]BRL[/TD]
[TD]1000[/TD]
[TD]#N/A
=IF(B2="USD",C2,INDEX(Sheet2!$B$2:$H$4,MATCH($B$2,Sheet2!$A$2:$A$3,0),MATCH("USD"&B2,Sheet2!$B$2:$H$2,0))*C2)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Sheet2
[TABLE="width: 500"]
<tbody>[TR]
[TD]A1[/TD]
[TD]Fx_RATES[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]USDJPY[/TD]
[TD]USDGBP[/TD]
[TD]USDHKD[/TD]
[TD]USDEUR[/TD]
[TD]USDSEK[/TD]
[TD]USDDKK[/TD]
[TD]USDBRL[/TD]
[/TR]
[TR]
[TD]31/08/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]30/09/2018[/TD]
[TD]112.05[/TD]
[TD].675[/TD]
[TD]15[/TD]
[TD]1.15[/TD]
[TD]7.5[/TD]
[TD]9.55[/TD]
[TD]3.25[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Much the same formula


Excel 2013/2016
BCD
1CcyValueValue_Fx'd
2GBP1000675
3GBP20001350
4GBP30002025
5USD40004000
6JPY5000560250
7DKK600057300
8SEK700052500
9BRL800026000
10GBP90006075
11EUR1000011500
12HKD11000165000
Sheet1
Cell Formulas
RangeFormula
D2=IFERROR(INDEX(Sheet2!B$1:H$3,MATCH(Sheet2!A$1,Sheet2!A$2:A$3,0)+1,MATCH("USD"&B2,Sheet2!B$1:H$1,0))*C2,C2)




Excel 2013/2016
ABCDEFGH
130/09/2018USDJPYUSDGBPUSDHKDUSDEURUSDSEKUSDDKKUSDBRL
231/08/2018110.050.575141.056.58.552.25
330/09/2018112.050.675151.157.59.553.25
Sheet2
 
Upvote 0
Translated with that extra row:

=IF(B2="USD",C2,INDEX(Sheet2!$B$3:$H$4,MATCH($A$1,Sheet2!$A$3:$A$4,0),MATCH("USD"&B2,Sheet2!$B$2:$H$2,0))*C2)

Or Fluff's:

=IFERROR(INDEX(Sheet2!$B$3:$H$4,MATCH($A$1,Sheet2!$A$3:$A$4,0),MATCH("USD"&B2,Sheet2!$B$2:$H$2,0))*C2,C2)
 
Upvote 0

Forum statistics

Threads
1,223,900
Messages
6,175,276
Members
452,629
Latest member
SahilPolekar

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