Currency Conditional formatting in Google Sheets - google-sheets

I am looking to automatically format my cells in a way that when the amount of a cell is already at more than 50,000 it automatically converts to IDR currency but if it's below that amount, it would be on $ currency. Please help

Please try the following formula
=INDEX(IF(LEN(B2:B),
IF(B2:B>=50000,TEXT(B2:B*GOOGLEFINANCE("Currency:USDIDR"),"Rp0.00"),TEXT(B2:B,"$0.00")),""))
Functions used:
INDEX
IF
LEN
TEXT
GOOGLEFINANCE

Related

How to use LAMBDA with GOOGLEFINANCE to perform currency conversions in an array?

I'm trying to write a formula that checks the currency of a stock position and performs a currency conversion if it is anything other than USD. I'd like to make column F into an array but the GOOGLEFINANCE formula doesn't work with the arrayformula. So I've tried using LAMBDA functions with BYROW and MAP but without success.
Column C lists the currency.
Column E lists the entry price of a stock position in that currency.
Column F uses the GOOGLEFINANCE formula to perform currency conversion and display the entry price in USD. (If the currency is pence (GBX), convert as GBP to USD then divide by 100. If the currency is USD, no conversion will be performed. For all other currencies, convert to USD.)
Column G is my attempt to do what column F does but as an arrayformula.
Column H is my attempt to do what column F does using the LAMBDA function with BYROW.
Yellow cells contain formula. Blue cells are manually inputted data.
I appreciate anyone who can take a look at my spreadsheet (linked below) and see what's the best solution for this. Sheet 2 is editable.
https://docs.google.com/spreadsheets/d/1JWkgH2Nf7CFI0Nh9H2-qEMRcwd8iMz7nxebuauplFiE/edit#gid=1126538379
Thanks!
J
added formula to your sheet:
=MAP(C2:C,E2:E,LAMBDA(cx,dx,IF(cx="",,ROUND(IFS(cx="GBX",(GOOGLEFINANCE("GBPUSD")*dx)/100,cx="USD",dx,LEN(cx),GOOGLEFINANCE(cx&"USD")*dx),2))))
-

Value imported can't be changed to a number

I'm using the function importhtml() on my Google Sheets :
=IMPORTHTML("https://fbref.com/fr/comps/13/Statistiques-Ligue-1";"table";3)
The data are imported but some data are displayed "01.08" and the value is a date. The other values are ok if they contains big number like 1.93. How it's possible to change that and have only numbers and not displayed that value as a date ?
I try to change the format of the cell but the value became a number like 44455.
This is a screen of what I have
Just with the importHTML without any cell formatting
After I format the cell as brut text
How can I have the value as a number so to display 1.08 and not 01.08 ( for Google SHeets this is a date )
Thanks a lot in advance
Just add a fourth parameter, which stands for locale.
=IMPORTHTML("https://fbref.com/fr/comps/13/Statistiques-Ligue-1";"table";3;"en_US")
This solved the problem here, since it turns the decimal points into commas, not allowing GS to interpret it as date format.

Remove $ Sign from importXML formula in Google Sheets

I have an issue with the IMPORTXML function and then changing the currency in my portfolio tracker.
IMPORTXML (C3=IMPORTXML(B3,"//div[#class='priceValue___11gHJ']") takes the price of a cryptocurrency from coinmarketcap (B3=https://coinmarketcap.com/currencies/ethereum/ - this all works fine (would rather prefer to have the prices from coingecko, but cannot figure the IMPORTXML function for that website... - if anyone has some valuable input for this too, would be great).
However, the imported price in C3 has a dollar sign before the actual numbers, which mess up the GOOGLEFINANCE formulas in columns D (D3=C3GoogleFinance("CURRENCY:USDEUR")) and E (E3=C3GoogleFinance("CURRENCY:USDGBP")). Screenshot of the error attached. Error Message
Does anyone know how to fix this?
Much appreciated!
Rob
On cell C3 you could use:
=VALUE(SUBSTITUTE(IMPORTXML(B3,"//div[#class='priceValue___11gHJ']"),"$",""))
References:
SUBSTITUTE
VALUE
If I understand correctly, the problem is that the imported price in C3 has a dollar sign in front of the actual numbers, which breaks down further processing by formulas.
To solve the problem, you can wrap the formula in C3 in a MID() formula that returns a segment of a string. If we specify a position number equal to 2, starting from which the string segment will be extracted, then the dollar sign at position 1 will be ignored. The sign of the pound or the euro will also be ignored - any currency sign with a length of 1 symbol.
10 is the segment length with some margin. Please note if the end of string is reached before segment length characters are encountered, MID returns the characters from starting position to the end of string.
C3:
=MID(IMPORTXML(B3,"//div[#class='priceValue___11gHJ']"),2,10)
MID()
Here's a little workaround to import the prices from coingecko, and remove the $ simbol, of course:
=SUBSTITUTE(IMPORTXML("https://www.coingecko.com/en/coins/ethereum"; "//div[contains(#data-controller,'coins-information')]//span[contains(#data-coin-symbol,'eth')]");"$";"")
But, as you can imagine, if they change the html structure of the site, this will stop working.
Have fun!

Why does a different result show up when filtering a date in google sheets?

I'm very new to programming so I'm not sure how to phrase this but in google sheets, I'm having a problem:
when filtering results using =IFERROR(FILTER('Segment Management'!B:B,'Segment Management'!A:A=B5)), it works perfectly fine with letters and numbers but when there's a date in Segment Management cell B5 it instead of saying the date (in this case 15/3/2020) it outputs "43906". Could I get some help to explain why it says this number instead of the date?
Date is considered as plain number in google sheets that's the reason you get numbers instead of date you can either do either of one
Select the column where you have put formula & in menu Format> Number> and select date formatting
OR
use this formula =ARRAYFORMULA(TEXT(FILTER('Segment Management'!B:B,'Segment Management'!A:A=B5),"DD/MM/YYYY"))

what is the formula for 1000 separator in google sheets?

I have a simple formula in a google sheet.
="Budget USD: "&SUM(D2:D)
This gives me Budget USD: 13425
what I want it to give me is Budget USD: 13,425
with the comma. Any help?
Use the FIXED function
FIXED(number_of_decimals, suppress_separator)
for instance
="Budget USD: "&FIXED(SUM(D2:D),0)
to show the number with the thousands commas separator, zero decimals.
(of course you don't want to set suppress_separator to keep the thousands commas separator).
More information about FIXED from Google documentation.

Resources