Dec 09 2022 06:21 PM
Hi,
I have an Excel sheet with several transactions in different currencies and on different dates. In the next sheet I have an overview of all the different currencies on each day for a given period of time.
In column A I have a date, and in Column F I have a currency code. In column G I need to return the currency rate from sheet two where the criteria’s date AND currency code is met.
What formula(s) should I use?
Dec 09 2022 10:34 PM
@EllenKristina
Based on your explanation, you could use INDEX and MATCH functions
also there is a VLOOKUP and XLOOKUP functions.
I'm not an expert but I can help you with my knowledge, if you want, you can share your file here so I can have better understanding on what you're looking for.
Dec 10 2022 12:11 AM - edited Dec 10 2022 12:16 AM
Thank you so much,
An example of this case is attached. Long story short - i need to know the rate to each purchase.
Edit: I was not able to upload the file for some reason...
Dec 10 2022 01:39 AM
Dec 10 2022 02:03 AM
Dec 10 2022 02:09 AM
I'm on Version 2210 (Build 15726.20202)
OK, so you run Excel 365 🙂
See one way with FILTER in the attached file
Dec 11 2022 07:54 PM - edited Dec 11 2022 08:01 PM
@EllenKristina
Here it is, hope you get what you're looking for.
I used concatenate for your criteria, "DATE" and "Currency Code" which I named it LOOKUP HELPER on your Currency sheet, and I use the VLOOKUP function on your Transaction sheet with the same concatenated cell/word of your criteria as a lookup value.
Dec 12 2022 01:13 AM
Another strategy is to blank out the dates with that correspond to the wrong currency and then use XLOOKUP to return the exact match from the remaining dates or, failing that, the next latest.
= LET(
filteredDates, IF(CXRateTbl[Code]=[@Code], CXRateTbl[Date]),
XLOOKUP( [@Date], filteredDates, CXRateTbl[Rate],"No match",1)
)
Placed within the Transactions Table the formula will propagate down the column. If used outside the Table one should aim at returning results as a dynamic array. This require the use of MAP and LAMBDA to get the inequalities between two arrays to work correctly
= MAP(Transactions[Date], Transactions[Code],
LAMBDA(date,code,
LET(
filteredDates, IF(CXRateTbl[Code]=code, CXRateTbl[Date]),
XLOOKUP(date, filteredDates, CXRateTbl[Rate],"No match",1)
)
)
)
Dec 21 2022 01:59 AM
You got several options. If any of them solves the issue, there's a link to mark the solution at the bottom 🙂 - This helps those who search
Thanks & nice day...