I've tried but I can't figure out how to add a prefix of currency symbol when certain conditions are done. For example:
I want that if I choose "$" and "Paycheck", the result in E2 were $10, and if I choose € in A2, the result were 11€.
I've been trying to achieve that but my code skills are improving very slowly..
Can anyone explain me the trick?
Assuming that in case you have € and Paycheck you want to add Price and Tax and this is how 11 is calculated.
Try this in cell E2:
=if(AND(B2="Paycheck",A2<>""),if(A2="$",C2,C2+D2),"")
Related
In my Google Sheet table, I use SWITCH command to convert a cell from coin symbol -> into coin value.
what I currently do:
=SWITCH(D660,"₪","ILS","$","USD","Ft","HUF","€","EUR","лв","BGN","£","EGP")
this will convert cell D660 from coin symbol (₪/$/Ft/€/лв/£) -> into coin name
here's an example of my data:
where in column E I have the equation above.
what I want to do:
I want to a more generic way, where I have a "hash-map" table in my Settings tab which contains the following table:
coin_symbol
coin_name
₪
ILS
$
USD
Ft
HUF
€
EUR
лв
BGN
£
EGP
and now I want the =SWITCH(D660,...) to use the table instead of hard coding inserting the conversion table
.
I'm struggling on this one, I tried stuffs like
=SWITCH(D660,A1:A10,B1:B10) or involving ARRAYFORMULA somewhere but nothing worked.
anyone have a suggestion how to implement that?
You can use VLOOKUP()
In table with the coins symbols and value as you described ( where symbols is column A and name column B)
=VLOOKUP([SYMBOL];[A1:B6];2;FALSE)
Where:
Symbol is the symbol you want to replace ( you can use cell reference );
A1:B6 is the table you want to look in;
2 is the column in wich you take the value;
False as the values are not ordered by a number, just use false.
/!\ depending on your locatioon the ; in my formula might have to be replaced by ,
Here's an example you could use
I have something like this:
In each E cell, I would like to return the D number of that row, as long as certain conditions are fulfiled, with the preffix $ if C2=$, and suffix € if C2=€.
I have this but it's not working at all (despite it is wrong, it probably can help you understand what I need):
=IF(A2="","",IFS(if(C2="$",OR(B2="Buy",B2="Sell"),"$"&D2,if(C2="€",OR(B2="Buy",B2="Sell"),D2&"€"))))
I'm sorry if I just posted something really awful, I tried...
Thanks!
For cell E2 you can use:
=IF(AND(A2<>"",OR(B2="Buy",B2="Sell")),SWITCH(C2,"$",C2&D2,"€",D2&C2,""),"")
And drag / copy-paste the formula to the remaining rows:
Delete everything from Column E including the header. Then try placing this in E1:
=ArrayFormula(IF(A2:A="",,IF(C2:C="$",C2:C&D2:D,D2:D&C2:C)))
Understand that once you "stick" the "$" or "€" to the numbers from Column D, they will not longer be numbers capable of having math performed on them. Rather, they will become strings. Maybe that won't matter to your application, since you already have the number values in Column D; but I figured you should know this.
I have a list of columns that contain city names:
E1 = New York
F1 = SF
G1 = Toronto
H1 = Seattle
Now lets assume A1 is Toronto - I now want to combine E:H except for A1.
The usual formula would be =E1&","&" "&F1&","&" "&G1","&" "&H1. However, since A1 is Toronto, G1 shouldn't be added.
How do I pull this off?
You could use formula:
=JOIN(", ",FILTER(E1:H1;E1:H1<>A1))
it uses filter to exclude A1 value (now I know filter works for both: vertical and horizontal ranges!).
And join is used to combine line into one string, and devide all values with comma and space.
Can you try with If condition to combine data from E:H. Eg: Below will merge if value is not same as A1.
=IF(E1=$A$1,"",E1&", ")&IF(F1=$A$1,"",F1&", ")&IF(G1=$A$1,"",G1&", ")&IF(H1=$A$1,"",H1&", ")
Please refer link here.
I have a column of values in varying currencies. I want to create a column that automatically detects the currency of a given value and converts that to GPB (or any other given currency).
I have the following formula for querying the exchange rate:
=INDEX(GoogleFinance("eurgbp","price",date(2014,9,15)),2,2)
However this requires that you specify the currency you are converting from. I want this to be dynamic, because my list of currencies varies.
You can return a text string representation of a formatted value with:
=TO_TEXT(A1)
So if you have the value 35 formatted as British Pound Sterling, the formula will return the string:
£35.00
Now you can match that string with a lookup table (probably using REGEXMATCH) to return the string required for GoogleFinance(). The trouble is that the native format of, say, the US dollar, is exactly the same as, say, the Australian dollar. However, you can set your own custom number formats (eg with USD or AUD appended) that will be carried through to the TO_TEXT function.
So you would probably need to describe all your possible currency formats to arrive at a more specific solution.
Sounds like you'll need to come up with some kind of encoding for the currency column values. For example:
Currency
----------
USD, 10254 # $102.54
RMB, 1010 # ¥101.0
You'd then need to parse that column value somehow in order to determine the currency type. Or you could have two columns. One for currency type and the other for currency value:
Type Currency
---- --------
USD 10254 # $102.54
RMB 1010 # ¥101.0
By the way, the currency columns are integers so you don't have to use floating point math which is a nice thing to avoid in my experience.
As AdamL mentioned, you need to check if there are currencies with the same symbols in your list of data.
If not, you can do the following:
Amt Text Amt Symbol
=========================================
(data) =TO_TEXT(A2) =left(B2,FIND(REGEXEXTRACT(B2,"[0-9\.\,]"),B2)-1)
This will get your currency symbol from the column A. The formula is finding the first occurrence of something numeric (including . and ,) and then you just take what is on the left of it to obtain the currency.
Then you need a table for each symbol to its ISO 3 letter code so you can use Google Finance to obtain the FX, something like:
Symbol ISO Ccy
======================================
$ USD
£ GBP
€ EUR
Then you can get the ISO ccy by using VLOOKUP and continue the formulas above, here I did the FX for GBP
Amt Symbol FX Convert Amt
===================================================================================================
(formula above) =IF(D2="GBP",1,INDEX(GoogleFinance(D2&"GBP","price",<SOMEDATE>),2,2)) =E2*A2
I saved an example here.
It is difficult to explain in words, so I have to show it instead:
Basically I have this:
And I want it to look like this:
Is there a formula that will let me create something like column B?
There's more countries than this in the actual excel (2003) file, and I cannot do this manually, as I'm planning to use data in column B to link to another formula in column C. Ultimately I want to be able to enter data manually elsewhere, and have column A filter the relevant countries (it already does this), column B to arrange them properly like the second image file, and column C to use that to calculate other stuff. I'm not very good at explaining so if I'm not making sense please say so.
EDIT: I'm trying to show this in words as well, but I don't really know how to format this, so sorry in advance
So basically I have this:
A ------ B ------ C
Japan
US
Germany
Indonesia
Malaysia
Vietnam
And I want it to look like this:
A B C
Japan
US
Germany
Indonesia
Malaysia
Vietnam
Sorry I know the formatting is bad I have no idea how I did the second part, but basically in the first one there's gaps in between countries in column A (e.g. A1 - Japan, A2 - US, A5 - Germany, A11 - Indonesia, A12 - Vietnam etc.) and I want column B to be B1 - Japan, B2 US, B3 - Germany, B4 - Indonesia, B5 - Vietnam ... does that make sense?
This is simply what you want Remove Blanks. Credits to Oscar Cronquist.
If the link is somehow broken, you use this formula in B1. Copy or auto-fill to other cells.
Change the range to suit.
=IFERROR(INDEX($A$1:$A$30, SMALL(IF(ISBLANK($A$1:$A$30), "", ROW($A$1:$A$30)-MIN(ROW($A$1:$A$30))+1), ROW(A1))),"")
This is an array formula entered by Ctrl+Shift+Enter.
Edit1: ISERROR Equivalent
=IF(ISERROR(INDEX($A$1:$A$30, SMALL(IF(ISBLANK($A$1:$A$30), "", ROW($A$1:$A$30)-MIN(ROW($A$1:$A$30))+1), ROW(A1)))),"",INDEX($A$1:$A$30, SMALL(IF(ISBLANK($A$1:$A$30), "", ROW($A$1:$A$30)-MIN(ROW($A$1:$A$30))+1), ROW(A1))))
Result: