Formula add on new Function

dorian25

New Member
Joined
Jan 25, 2023
Messages
3
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
  2. MacOS
Hi all,

I trust that you are well.

My issue consists of not being not able to add to my initial formula with an if(vlookup) function (not sure why).

As you can see in column K4 the formula looks for the date, currency, Amount, Date USD, and Close to make an adjustment if there is a currency other than EUR. The issue is if column K (date) has not yet happened (e.g.) it makes the cell go empty but not "0" and this makes my other function on this column sum-product no workable. That's why I am trying to add this new function '=+IF(VLOOKUP(I15,D4:E2888,1,TRUE)=I15,"","0") to make it add a 0 if the column K and column D/F has not happened yet

Could you also help me do this formula for USD and GBP combined?

Formula USD: '=IF(K4="total:","0",IF(L4=0,"0",IFERROR(IF(J4="USD",L4/(IFERROR(VLOOKUP(K4,$D$4:$E$5002,2,FALSE),IFERROR(VLOOKUP(K4+1,$D$4:$E$5002,2,FALSE),VLOOKUP(K4+2,$D$4:$E$5002,2,FALSE)))),L4),"")))
Formula GBP: '=IF(K11="total:","0",IF(L11=0,"0",IFERROR(IF(J11="GBP",L11/(IFERROR(VLOOKUP(K11,$F$4:$G$5002,2,FALSE),IFERROR(VLOOKUP(K11+1,$F$4:$G$5002,2,FALSE),VLOOKUP(K11+2,$F$4:$G$5002,2,FALSE)))),L11),"")))
New Formula: '=+IF(VLOOKUP(I15,D4:E2888,1,TRUE)=I15,"","0")

Thank you so much in advance.

Kind regards,
Dorian

1674668770546.png
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
did change a couple of the dates in the original post data to test each currency type.
try this:
---------------------
Book1
DEFGHIJKLM
2Final
3Date USDCloseDate GBPCloseNameCurrencyDateAmountAmount, EUR
41/2/2012$ 1.291/2/2012£ 0.83AltoEUR1/9/20121,712,773.001,712,773.00
51/3/2012$ 1.321/3/2012£ 0.83AltoEUR5/23/201842,200.00-
61/4/2012$ 1.291/4/2012£ 0.83AltoEUR12/14/2018678,000.00-
71/5/2012$ 1.281/5/2012£ 0.83AltoUSD1/9/20121,395,000.001,089,843.75
81/6/2012$ 1.271/6/2012£ 0.82AltoEUR3/25/20241,411,000.00-
91/9/2012$ 1.281/9/2012£ 0.83AltoEUR12/18/2020102,000.00-
101/10/2012$ 1.281/10/2012£ 0.82AltoGBP1/9/20121,154,000.0026,000.00
111/11/2012$ 1.271/11/2012£ 0.83AltoGBP3/24/20221,245,000.00-
121/12/2012$ 1.281/12/2012£ 0.84AltoEUR6/10/2022510,000.00-
131/13/2012$ 1.271/13/2012£ 0.83AltoEUR7/8/202226,000.00-
141/16/2012$ 1.271/16/2012£ 0.83AltoUSD10/21/202427,000.00-
151/17/2012$ 1.271/17/2012£ 0.83AltoUSD10/30/202215,000.00-
161/18/2012$ 1.291/18/2012£ 0.83
171/19/2012$ 1.301/19/2012£ 0.84
181/20/2012$ 1.291/20/2012£ 0.83
Sheet1 (2)
Cell Formulas
RangeFormula
M4:M15M4=IFERROR(IF(MATCH(K4,D:D,0)>0,IFS(K7="total",0,L4=0,0,J4="USD",IFERROR(IF(J4="USD",L4/(IFERROR(VLOOKUP(K4,D:E,2,FALSE),IFERROR(VLOOKUP(K4+1,D:E,2,FALSE),VLOOKUP(K4+2,D:E,2,FALSE)))),L4),""),J4="GBP",IFERROR(IF(J7="GBP",L7/(IFERROR(VLOOKUP(K7,F:G,2,FALSE),IFERROR(VLOOKUP(K7+1,F:G,2,FALSE),VLOOKUP(K7+2,F:G,2,FALSE)))),L7),""),J4="EUR",L4),0),0)
 
Upvote 0
Hi,

Thanks for the help.

But there are two issues with your formula.

1. if column K (date) appears on a weekend my formula would do a +1 or a +2 to get a match from columns D and F. You're for some reason does not...

2. In your formula if the date in column K does not exist in columns D and F it will return a blank. This is what trying to solve to get a 0. Because I am trying to make a sumproduct on columns K and M and unfortunately if it is only banc the formula does not work.

Thank you in advance.

Cheers,
Dorian
 
Upvote 0
How about
Excel Formula:
=IF(OR(K7="total",L4=0),0,IF(J4="USD",IFNA(L4/VLOOKUP(WORKDAY(K4-1,1),$D$4:$E$5002,2,0),0),IF(J4="GBP",IFNA(L4/VLOOKUP(WORKDAY(K4-1,1),$F$4:$G$5002,2,0),0),L4)))
 
Upvote 0
i updated my formula to correct the weekend dates, it will also show a 0 in the Amount EUR column if the date has not happened yet.
the data given does not have all the dates used. please try the below formula and let us know if it works for your needs
-----------------------
Formula add on new Function- currency convert by date.xlsx
DEFGHIJKLMNO
2PreviousFluffNew
3Date USDCloseDate GBPCloseNameCurrencyDateAmountAmount, EUR
41/2/2012$ 1.291/2/2012£ 0.83AltoEUR1/7/20121,712,773.000.001712773.001712773.00
51/3/2012$ 1.321/3/2012£ 0.83AltoEUR5/23/201842,200.000.0042200.000.00
61/4/2012$ 1.291/4/2012£ 0.83AltoEUR12/14/2018678,000.000.00678000.000.00
71/5/2012$ 1.281/5/2012£ 0.83AltoUSD1/8/20121,395,000.000.001089843.751089843.75
81/6/2012$ 1.271/6/2012£ 0.82AltoEUR3/25/20241,411,000.000.001411000.000.00
91/9/2012$ 1.281/9/2012£ 0.83AltoEUR12/18/2020102,000.000.00102000.000.00
101/10/2012$ 1.281/10/2012£ 0.82AltoGBP1/9/20121,154,000.001390361.451390361.451390361.45
111/11/2012$ 1.271/11/2012£ 0.83AltoGBP3/24/20221,245,000.000.000.000.00
121/12/2012$ 1.281/12/2012£ 0.84AltoEUR6/10/2022510,000.000.00510000.000.00
131/13/2012$ 1.271/13/2012£ 0.83AltoEUR7/8/202226,000.000.0026000.000.00
141/16/2012$ 1.271/16/2012£ 0.83AltoUSD10/21/202427,000.000.000.000.00
151/17/2012$ 1.271/17/2012£ 0.83AltoUSD10/30/202215,000.000.000.000.00
161/18/2012$ 1.291/18/2012£ 0.83
171/19/2012$ 1.301/19/2012£ 0.84
181/20/2012$ 1.291/20/2012£ 0.83
Sheet1 (2)
Cell Formulas
RangeFormula
M4:M15M4=IFERROR(IF(MATCH(K4,D:D,0)>0,IFS(K4="total",0,L4=0,0,J4="USD",IFERROR(IF(J4="USD",L4/(IFERROR(VLOOKUP(K4,D:E,2,FALSE),IFERROR(VLOOKUP(K4+1,D:E,2,FALSE),VLOOKUP(K4+2,D:E,2,FALSE)))),L4),""),J4="GBP",IFERROR(IF(J4="GBP",L4/(IFERROR(VLOOKUP(K4,F:G,2,FALSE),IFERROR(VLOOKUP(K4+1,F:G,2,FALSE),VLOOKUP(K4+2,F:G,2,FALSE)))),L4),""),J4="EUR",L4),0),0)
N4:N15N4=IF(OR(K4="total",L4=0),0,IF(J4="USD",IFNA(L4/VLOOKUP(WORKDAY(K4-1,1),$D$4:$E$5002,2,0),0),IF(J4="GBP",IFNA(L4/VLOOKUP(WORKDAY(K4-1,1),$F$4:$G$5002,2,0),0),L4)))
O4:O15O4=IFERROR(IF(MATCH(WORKDAY(K4,1),D:D,0)>0,IFS(K4="total",0,L4=0,0,J4="EUR",L4,J4="USD",IFNA(L4/VLOOKUP(WORKDAY(K4-1,1),D:E,2,0),0),J4="GBP",IFNA(L4/VLOOKUP(WORKDAY(K4-1,1),F:G,2,0),0)),0),0)
 
Upvote 0
Personally I would avoid using the IFS function on something like this as it is less efficient (and therefore slower) than nested IF functions.
 
Upvote 0
Well, guys, the formula works now thank you both for the help.

Much Appreciated!
Dorian
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,318
Members
452,634
Latest member
cpostell

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