Sep 14 2024 03:54 AM
Hello,
May I ask for help with this please.
I am running a web store, and in columns A-C (marked as 1) you can see parts of the sales report (see screenshot).
In column D, I wish to automatically insert the correct currency exchange rate for the Purchase Date (column B) and for the currency that was used to pay the order (column C).
Columns F-H and J-L (marked as 2 and 3) contains the exchange rates that should be used for Euro and USD.
So to get the correct currency exchange rates into the different rows of column D, the formula needs to:
-check that the order date (column B) is the same as the date in column F or J.
-check that the order currency (column C) is the same as the currency in column G or K.
For example:
-In cell D2, the correct currency exchange rate to be inserted is 10,35498 (from cell L10), because the order date (column B) is 2024-09-11 and the currency (column C) is USD.
Thank you!
Sep 14 2024 04:13 AM
Solution=IF(C2="USD",INDEX($L$2:$L$16,MATCH(B2,$J$2:$J$16,0)),INDEX($H$2:$H$16,MATCH(B2,$F$2:$F$16,0)))
You can use IF along with INDEX and MATCH.
Sep 14 2024 04:41 AM
@OliverScheurich Perfect, thank you very much!
Sep 14 2024 05:22 AM
I'd only use 1 instead of 0 as third parameter in MATCH for @OliverScheurich solution. Exchange rate skips non-trading dates. Look, you have exchange rate for Aug 30 and next for Sep 2. Since Aug 31 and Sep 01 are on weekend.
However, order could be date on last date of the month, i.e. Aug 31. If so with parameter 0 you have an error. With parameter 1 you have exchange rate for the last previous date, i.e. for Aug 30. Which is correct, exchange rates for not-trading dates are the same as for last trading date.
Sep 14 2024 05:55 AM
Sep 14 2024 06:45 AM
@SergeiBaklan and @OliverScheurich
If I wish to add a third currency, my domestic SEK, as shown in the screenshot columns N-P, how would I write the formula?
Thank you!
Sep 14 2024 07:48 AM
On which Excel platform/version you are? Is that Excel365, 2021 or earlier one?
Sep 14 2024 07:57 AM
Okay, on any Excel that could be
=INDEX( INDEX($F$2:$Q$1000, 0, MATCH(C2, $F$2:$Q$2, 0)+1 ), MATCH(B2, INDEX($F$2:$Q$1000, 0, MATCH(C2, $F$2:$Q$2, 0)-1 ), 1 ) )
Sep 14 2024 08:18 AM
Sep 14 2024 12:07 PM
An INDEX variant using the seldom used reference arrangement:
=LET(
i, XMATCH(dates, EUR[date]),
a, XMATCH(currency, {"EUR", "USD", "SEK"}),
INDEX((EUR, USD, SEK), i, 3, a)
)
Sep 14 2024 04:10 PM
Sep 14 2024 04:13 AM
Solution=IF(C2="USD",INDEX($L$2:$L$16,MATCH(B2,$J$2:$J$16,0)),INDEX($H$2:$H$16,MATCH(B2,$F$2:$F$16,0)))
You can use IF along with INDEX and MATCH.