Dynamic currency conversion based on symbol + lookup [excel] - excel

Example illustrated below, but I essentially have 3 columns:
Column A is 3-letter currency abbreviation (total 4 types).
Column B is an amount.
Column C is a 2-letter country code (total 2 types).
What I need is for column D to apply a custom conversion to the column B amount, with output in the currency of column C and based on the conversion rate of column A.
To illustrate:
Row 1: Both currency and country are same = no change to value.
Row 2: Both currency and country are same = no change to value.
Row 3: Currency is JPY, country is UK = B4 amount * JPY to GBP rate.
Row 4: Currency is EUR, country is US = B5 amount * EUR to USD rate.
So, basically an if statement to check what the code is in column A, then apply a custom multiplier based on column C.
I don't suppose anyone can think of an elegant way to do this?

It depends on how you have your conversion values. If you have them in a table like in the below snapshot, then you can use INDEX/MATCH like this:
=INDEX($H$2:$K$5,MATCH(A2,$G$2:$G$5,0),MATCH(C2,$H$1:$K$1,0))*B2
Conversely if you have something more like the following snapshot, then using SUMIFS would be easier:
=SUMIFS(I:I,G:G,A2,H:H,C2)*B2

Related

Number occurrences in another cell (Excell) [duplicate]

I have simple problem, but I've not be able to get an answer from searching. I require a column to calculate the number of the nth occurrence of a value. It's best explained in this picture
I require a method to calculate column B.
I'd be very grateful for any help.
Are you looking to merely provide a count of the distinct entries of column A in column B? Or merely add a formula to come up with the table in your link?
If the latter, then the formula to write in cell B2 is:
=COUNTIF(A$2:A2,A2)
then copy/paste it down column B. Note - if your data is both a Date and Time, but the cell is formatted to only display a date, you may not get the results you want. You'd need to interject a new column with a "floor" calculation to round the date/time value to a date (Excel date times are decimal, with integer part dictating the date, and remaining 0.0 -> 1.0 dictating the time of day)
If you just want to derive a table of the counts of distinct entries in column A, then a pivot table will do this for you - simple add a pivot table to cover the data in column A, then select column A into the rows category, and then also drag it into the values category, ensuring the field is set to "Count of". You should then have a table with the distinct entries in your data set in one column, and the count of their occurrences in the other column.
You can use the COUNTIF worksheet function, with a relative address.
Eg. In cell B2, enter this formula:
=COUNTIF(A$2:A2,A2)
And then fill-down.
Use the following formula to generate the required series:
=COUNTIF($A$1:A1,A1) and strech(copy) it in all the cells
This will generate result like this:
A 1 COUNTIF($A$1:A1,A1)
A 2 COUNTIF($A$1:A2,A2)
C 1 COUNTIF($A$1:A3,A3)
C 2 COUNTIF($A$1:A4,A4)
B 1 COUNTIF($A$1:A5,A5)
B 2 COUNTIF($A$1:A6,A6)
A 3 COUNTIF($A$1:A7,A7)
C 3 COUNTIF($A$1:A8,A8)
D 1 COUNTIF($A$1:A9,A9)
D 2 COUNTIF($A$1:A10,A10)
D 3 COUNTIF($A$1:A11,A11)
D 4 COUNTIF($A$1:A12,A12)

Excel database - formula multiplication exchange rate by date

I am creating some accounting papers and I need multiplicate USD exchange rate with our currency by date. I tried everything, but I don't know how to do it..
Here is example:
DATE | USD | CZK
1.1.2018 | 2$ | USD Price * CZK Price by same date
2.2.2018 | 2$ | USD Price * CZK Price by same date
EXCHANGE RATE
1.1.2018 | 22
2.2.2018 | 23
(It means that price on 1.1 will be 44CZK and 2.2 will be 46CZK)
And this I need do for every day in year.
So hand writing isn't possible. I need some formula for it.
Can you help me please? I know that it can be by vlookup and If..
Thanks!
You can use INDEX with MATCH to achieve this as well and wrap in IFERROR in case a match for the "date" string is not found in the lookup column. If a match is found in the lookup column E, for the "date" string in column A the number returned for the match is passed as a row number argument for Index on column F which returns to rate in the same row as the match was found. This is then multiplied by column B.
You would alter the ranges $F$2:$F$3 and $E$2:$E$3 to encompass all your actual rows in those columns.
In B2 and drag down
=IFERROR(B2*INDEX($F$2:$F$3,MATCH(A2,$E$2:$E$3,0)),"")
Yes, you can muliply with the exchange rate in your cell while doing the lookup at the same time, so in Cell C2:
=B2*(VLOOKUP(A2,$E$2:$F$3,2,FALSE))
I.e. VLOOKUP(A2,$E$2:$F$3,2,FALSE) will give you the exchange rate,
A2: Lookup value, the date in our case.
$E$2:$F$3: Where we can find the date in your "search area". Notice that the date we search for, needs to be in the first column of our "search area".
2: In our "search area", from which column number should we return our return number/value. In our case our "search area" is two column, where we want the result to be return from the 2nd column of column E and F.
FALSE: Search for exact match.
When the exchange rate is found we mulptiply it with the dollar amount, i.e. B2 * Vlookup() :)

Calculate Occurrence Number - Excel

I have simple problem, but I've not be able to get an answer from searching. I require a column to calculate the number of the nth occurrence of a value. It's best explained in this picture
I require a method to calculate column B.
I'd be very grateful for any help.
Are you looking to merely provide a count of the distinct entries of column A in column B? Or merely add a formula to come up with the table in your link?
If the latter, then the formula to write in cell B2 is:
=COUNTIF(A$2:A2,A2)
then copy/paste it down column B. Note - if your data is both a Date and Time, but the cell is formatted to only display a date, you may not get the results you want. You'd need to interject a new column with a "floor" calculation to round the date/time value to a date (Excel date times are decimal, with integer part dictating the date, and remaining 0.0 -> 1.0 dictating the time of day)
If you just want to derive a table of the counts of distinct entries in column A, then a pivot table will do this for you - simple add a pivot table to cover the data in column A, then select column A into the rows category, and then also drag it into the values category, ensuring the field is set to "Count of". You should then have a table with the distinct entries in your data set in one column, and the count of their occurrences in the other column.
You can use the COUNTIF worksheet function, with a relative address.
Eg. In cell B2, enter this formula:
=COUNTIF(A$2:A2,A2)
And then fill-down.
Use the following formula to generate the required series:
=COUNTIF($A$1:A1,A1) and strech(copy) it in all the cells
This will generate result like this:
A 1 COUNTIF($A$1:A1,A1)
A 2 COUNTIF($A$1:A2,A2)
C 1 COUNTIF($A$1:A3,A3)
C 2 COUNTIF($A$1:A4,A4)
B 1 COUNTIF($A$1:A5,A5)
B 2 COUNTIF($A$1:A6,A6)
A 3 COUNTIF($A$1:A7,A7)
C 3 COUNTIF($A$1:A8,A8)
D 1 COUNTIF($A$1:A9,A9)
D 2 COUNTIF($A$1:A10,A10)
D 3 COUNTIF($A$1:A11,A11)
D 4 COUNTIF($A$1:A12,A12)

recalculate currency by selection curency symbol from drop down box

I need to recalculate the value every time user selects a currency from drop down box.
Example
column A column B
product 1 25
product 2 34
product 3 16
lets assume that the value in column B is in Euro, I need to create a drop down box that contains EURO, USD, GBP and so on.
Every time I select one of the currency from drop down list I want column B to recalculate based on currency rate between Euro and the selected currency.
Any ideas how to do it?
Add a column for the converted values, calculated as the Euro values (ColumnB) multiplied by say E1:
=IF(B2<>"",B2*E$1,"")
with the formula in say D2 and copied down to suit. D1 might hold your drop-down list, driven from a lookup table that next to the currency indicator (immediately to the right) holds the conversion factor. Say that table is H1:I3, then in E1:
=VLOOKUP(D1,H1:I3,2,0)

Generating letter by its position in the alphabet

I want a formula that can return the letter of the excel alphabet (27 = AA etc.) of a given number.
The purpose of this is that I have a table that returns values in a spreadsheet. I am summarizing data of climate measurements in cities, this data takes up 4 columns (but the same rows and relative positions in each column, so I29 and J29 contain 2 numbers I need, and then M29 and N29 contain the same data for the next location.
I want to create a summary table that looks like the below
City Rainfall Average Sunshine Average
City A =I29 =J29
City B =M29 =N29
City C etc.
my problem is that i go up to a few hundred cities, and i want to be able to populate the cells automatically/fill down. I know what row the data is in but need to generate the column letters using the formula requested above, so I can use a concatenate to create the cell reference.
You can use the ADDRESS function.
For example, =ADDRESS(29,27) will return the string "$AA$29".
However, honestly in your situation I would use the OFFSET function, combined with ROW(). To illustrate, let's say your table starts with a header row on row 50 and data starts on row 51. The data for a given city would start (ROW() - 51) * 4 columns to the right of I29. So:
A B C
50 City Rainfall Average Sunshine Average
51 City A =OFFSET($I$29,0,(ROW()-51)*4) =OFFSET($I$29,0,(ROW()-51)*4+1)
52 City B =OFFSET($I$29,0,(ROW()-51)*4) =OFFSET($I$29,0,(ROW()-51)*4+1)
53 City C etc.
Of course, you have to be careful if you want to move these cells around; you'll have to change the 51.

Resources