google sheet : function convert number (string) into money format - google-sheets

When i put number in a cell, i can use numbering/money format. For example :
123456 into 123,456.00
but this time , i need something like this but using function. Because the number will be add to a string. For example :
= "USD "& A1
if A1 contains 123456 then the output will be :
USD 123456
But i want the output to be formatted like this :
USD 123,456.00

Try
= "USD "& text(A1, "#000,000.00")
and see if that helps?

Related

Google Sheet - Concatenate text with date format

How with Google Sheet I can concatenate text and date ?
This is what I have tried:
=CONCATENATE("Date : "; TEXT(C9, "YYYY-MM-DD"); ". Thanks.")
Output should be:
Date : 2023-01-03. Thanks.
Thanks.
You can get the value in cell C9 in the format it shows in the spreadsheet with the to_text() function, like this:
="Date: " & to_text(C9) & ". Thanks."

Display all values in columns (Query formule)

I'm trying to use a query function in my google sheet.
But I have a little problem :
When I have same/less "R" than date so it display me only date and not the "R"
For example:
Another example:
And now, when I have more "R" so it's display everything:
So how can I display everything when I have same or less "R" (it can b R or any letter) ?
https://docs.google.com/spreadsheets/d/1svXFqHVtbgMfHPZjxS3X9AKW679AqrVyMDySay2lzfw/edit?usp=sharing
Thanks for your help
Try
=QUERY(arrayformula(to_text(H1:J6)),"WHERE Col3 IS NOT NULL " ,0)
the problem comes from a combination of string and numeric value in the same column (date is numeric), query does not work well and you have to convert data into strings. Because the source is now a function, you will have to use Colx instead of letter of column.

Error in number formatting in Google Sheet

I need to format the numbers in a column like this:
08146.000331/2021-32
But, when I use the following format
00000"."000000"/"0000"-"00
The result is
08146.000331/2021-30
What am I doing wrong?
There is a formula to achieve the aimed result?
This is the actual sheet: link
Some of the values in column C are numbers and some are text strings that look like numbers.
Click in column C and choose Insert > Column right to create a new column D. Then insert this formula in cell D4:
=arrayformula(
{
"Formatted SEI";
regexreplace(trim(C5:C); "^(\d{5})(\d{6})(\d{4})(\d{2})$"; "$1.$2/$3-$4")
}
)
The formula converts all values to text strings and inserts separators.
Try
000"."000"."000"-"00 ---> for CPF, and
00"."000"."000"/"0000"-"00 ---> for CNPJ.
For numbers with more then 14 digits, this type of formatting don't works due to numeric precision limit.
Um abraço.

google sheet formula to get convert two column table into JSON and use display value instead of cell value

Example sheet: https://docs.google.com/spreadsheets/d/1KLAB9PTGQfKJ4XWTVFScNyhlFkZSKcrMRWn4z0wGKZU/edit?usp=sharing
I have a table with a variable number of rows and two columns. I want to convert the table to a JSON string with the first column being the key and second column being the value.
I have a formula but it uses the cell value and not the cell display value. For example, in my above example sheet, it outputs:
"number" : "1" instead of "number" : "1.0"
"date" : "4378" instead of "date" : "2019-11-15"
Is there a way to tell the formula to use the cell display value and not the cell value?
Convert the second column to text:
="{" & TEXTJOIN(", ", TRUE, ARRAYFORMULA(IF(A2:A<>"", """" & A2:A & """ : """ & TO_TEXT(B2:B) & """", ""))) & "}"
and see if that works?

Keep result of SPLIT() as string instead of number for VLOOKUP()

In Google Sheets, I have this formula:
=ARRAYFORMULA( VLOOKUP( SPLIT(F2,", "), A2:B8, 2, FALSE) )
The intent is to take the comma-delimited string in cell F2 and find all values associated with the pieces. This works correctly, except when one of the pieces of the string looks like a number. For example, if F2 has the text a, 1.2, 1.2.3 then VLOOKUP will look for a as a string, and for 1.2.3 as a string, but will look for 1.2 as a number.
How can I coerce the result of SPLIT so that each piece remains a string?
I have a public copy of a test spreadsheet viewable here:
https://docs.google.com/spreadsheets/d/115WmV0vfXfaRgT0fVifJo86od3irZQy5gB3l-g6c7Ts/edit?usp=sharing
As background information, VLOOKUP treats strings and numbers differently. For example, given this table (where the formulae are shown for the first column):
A B
1 ="1.2" STR
2 =1.2 NUM
4 =VLOOKUP("1.2",A1:B2,2,0)
5 =VLOOKUP(1.2,A1:B2,2,0)
...the value shown in A4 will be "STR", and the value shown in A5 will be "NUM".
You can CONCAT a number with an empty string to convert it into its equivalent string representation.
CONCAT(1.2,"") yields "1.2"
To do this for every value, you must wrap the CONCAT() call in ARRAYFORMULA():
=ARRAYFORMULA(CONCAT(SPLIT(F2,", "),""))
The final formula thus becomes:
=TRANSPOSE(ARRAYFORMULA(VLOOKUP(ARRAYFORMULA(CONCAT(SPLIT(F2,", "),"")),A2:B8,2,FALSE)))

Resources