I currently using this code in Google Sheet to replace my numbers(Currency) to text. But its showing error for this part
IF(IFERROR(QUERY({Y:Y},"where Col1 Contains '.'"),)<>"", " and "®EXEXTRACT(TO_TEXT(Y:Y), "\.(.+)")&" cents", ))," ", " ")
What should I change to make it work properly?
My full code below:
=ARRAYFORMULA(IFS(ROW(AQ:AQ)=1,"WageWords",A:A="","",TRUE,REGEXREPLACE(IF(OR(LEN(FLOOR(Y:Y,1))>=13,FLOOR(Y:Y,1)<=0),"", PROPER(SUBSTITUTE(CONCATENATE(CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),1,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "), CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),2,1)+1,"",CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),3,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"), IF(VALUE(MID(TEXT(INT(Y:Y), REPT(0,12)),2,1))>1,CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),3,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"), IF(VALUE(MID(TEXT(INT(Y:Y), REPT(0,12)),2,1))=0,CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),3,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")), IF(Y:Y>=10^9," billion ",""), CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),4,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "), CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),5,1)+1,"",CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),6,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"), IF(VALUE(MID(TEXT(INT(Y:Y), REPT(0,12)),5,1))>1,CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),6,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"), IF(VALUE(MID(TEXT(INT(Y:Y), REPT(0,12)),5,1))=0,CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),6,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")), IF(VALUE(MID(TEXT(INT(Y:Y), REPT(0,12)),4,3))>0," million ",""),CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),7,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "), CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),8,1)+1,"",CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),9,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"), IF(VALUE(MID(TEXT(INT(Y:Y), REPT(0,12)),8,1))>1,CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),9,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"), IF(VALUE(MID(TEXT(INT(Y:Y), REPT(0,12)),8,1))=0,CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),9,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")), IF(VALUE(MID(TEXT(INT(Y:Y), REPT(0,12)),7,3))," thousand ",""),CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),10,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "), CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),11,1)+1,"",CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),12,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"), IF(VALUE(MID(TEXT(INT(Y:Y), REPT(0,12)),11,1))>1,CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),12,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"), IF(VALUE(MID(TEXT(INT(Y:Y), REPT(0,12)),11,1))=0,CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),12,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")))," "," "))& IF(IFERROR(QUERY({Y:Y},"where Col1 Contains '.'"),)<>"", " and "®EXEXTRACT(TO_TEXT(Y:Y), "\.(.+)")&" cents", ))," ", " ")))
use:
=ARRAYFORMULA(IF(Y:Y="",,REGEXREPLACE(IF((LEN(FLOOR(Y:Y,1))>=13)+(FLOOR(Y:Y,1)<=0),"Out of range",
PROPER(SUBSTITUTE((CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),1,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred ")&
CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),2,1)+1,"",CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),3,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety")&
IF(VALUE(MID(TEXT(INT(Y:Y),
REPT(0,12)),2,1))>1,CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),3,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),
IF(VALUE(MID(TEXT(INT(Y:Y),
REPT(0,12)),2,1))=0,CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),3,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),""))&
IF(Y:Y>=10^9," billion ","")&
CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),4,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred ")&
CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),5,1)+1,"",CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),6,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety")&
IF(VALUE(MID(TEXT(INT(Y:Y),
REPT(0,12)),5,1))>1,CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),6,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),
IF(VALUE(MID(TEXT(INT(Y:Y),
REPT(0,12)),5,1))=0,CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),6,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),""))&
IF(VALUE(MID(TEXT(INT(Y:Y),
REPT(0,12)),4,3))>0," million ","")&CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),7,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred ")&
CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),8,1)+1,"",CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),9,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety")&
IF(VALUE(MID(TEXT(INT(Y:Y),
REPT(0,12)),8,1))>1,CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),9,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),
IF(VALUE(MID(TEXT(INT(Y:Y),
REPT(0,12)),8,1))=0,CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),9,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),""))&
IF(VALUE(MID(TEXT(INT(Y:Y),
REPT(0,12)),7,3))," thousand ","")&CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),10,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred ")&
CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),11,1)+1,"",CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),12,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety")&
IF(VALUE(MID(TEXT(INT(Y:Y),
REPT(0,12)),11,1))>1,CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),12,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),
IF(VALUE(MID(TEXT(INT(Y:Y),
REPT(0,12)),11,1))=0,CHOOSE(MID(TEXT(INT(Y:Y),
REPT(0,12)),12,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")))," "," "))&
IFERROR(IF(REGEXMATCH(TO_TEXT(Y:Y), "\."),
" and "®EXEXTRACT(TO_TEXT(Y:Y), "\.(.+)")&" cents", )))," ", " ")))
Related
I have a spreadsheet (Google Sheets) with several non-contiguous Cost columns. When I try to user ArrayFormula to sum each row "Grand Total", it's returning some interesting (incorrect) numbers.
Here's a sample, stripped down the number of cost columns for brevity.
Venue Cost
Moving
Moving Details
AV Support
Grand Total
1500
500
500
2500
2500
500
750
3750
1500
500
500
2500
My Array Formula for the Grand Total Column is
=ARRAYFORMULA(filter(G2:G, G2:G<>"") + SUM(H2:H,J2:J))
where G is the Venue Cost and H and J are additional costs.
This is the resulting Grand Total:
Venue Cost
Moving
Moving Details
AV Support
Grand Total
1500
500
500
4750
2500
500
750
5750
1500
500
500
4750
I tried moving away from SUM, to just manually adding the additional costs together.
=ARRAYFORMULA(filter(G2:G, G2:G<>"") + (J2:J + H2:H ))
but received the #N/A error, which expanded to "Error: Array arguments to ADD are of different size." We have a document generating tool that sees those N/A's as additional jobs to process, so any extra spillover is not good:
Venue Cost
Moving
Moving Details
AV Support
Grand Total
1500
500
500
2500
2500
500
750
3750
1500
500
500
2500
#N/A
#N/A
I'm pretty sure that the SUM and the ADD versions are including more than one row, do I need to filter the 'Additional Costs' Columns as well as the Venue Costs? Or, are the non-contiguous columns an issue?
Thank you!
try:
=INDEX(IF(G2:G="",,G2:G+H2:H+J2:J))
or:
=BYROW({G2:H, J2:J}, LAMBDA(x, SUM(x)))
or:
=BYROW({G2:H, J2:J}, LAMBDA(x, IFERROR(1/(1/SUM(x)))))
or:
=BYROW({G2:INDEX(H:H, COUNTA(G:G)), J2:INDEX(J:J, COUNTA(G:G))}, LAMBDA(x, SUM(x)))
I don't know if I fully understand what you're trying to accomplish, but try this:
=ARRAYFORMULA(IF(G2:G="","",G2:G+H2:H+J2:J))
I have cells with data in a format:
12 345,67 EUR
(twelve thousand three hundred forty five EUR and sixty seven cents)
I can't change this format (I need to copy&paste a lot of those into the spreadsheet from another source).
I'm trying to make some calculations with it but it shows me #VALUE! error saying it's a text and cannot be coerced to a number. I tried to format those cells as custom number format ##,###.00" EUR" but it doesn't work.
try:
=REGEXREPLACE(A1; "[ EUR]"; )*1
I have cells with data in a format:
12 345,67 EUR
(twelve thousand three hundred forty five EUR and sixty seven cents)
I can't change this format (I need to copy&paste a lot of those into the spreadsheet from another source).
I'm trying to make some calculations with it but it shows me #VALUE! error saying it's a text and cannot be coerced to a number. I tried to format those cells as custom number format ##,###.00" EUR" but it doesn't work.
try:
=REGEXREPLACE(A1; "[ EUR]"; )*1
I've been struggling for a couple of days now how to get this to work. I have a set of data that I get in a CSV format, that I will copy past in a Google Sheets workbook.
On sheet 1 I have the following (example) data:
Hours Expertise Responsible Rate Total
4 Cleaning Bob 11 44
2 Cleaning Barb 15 30
3 Woodwork Xander 19 57
1,5 Electricity Bob 22 33
There are only 3 responsible people in this example, and I now need to create a sheet per person, showing only their data, but in the same way as it is in the combined sheet.
So what I would like to end up with (for this example) are 3 sheets:
Sheet Bob
Hours Expertise Responsible Rate Total
4 Cleaning Bob 11 44
1,5 Electricity Bob 22 33
Sheet Barb
Hours Expertise Responsible Rate Total
2 Cleaning Barb 15 30
Sheet Xander
Hours Expertise Responsible Rate Total
3 Woodwork Xander 19 57
But to be honest, I'm kinda lost right now. I couldn't get this to work with pivot table or any of the other things I could find with google. I also tried using Vlookup, but then I end up with empty lines in between.
use:
=QUERY({'sheet 1'!A:E}, "where Col3 = 'Bob'", 1)
=QUERY({'sheet 1'!A:E}, "where Col3 = 'Barb'", 1)
=QUERY({'sheet 1'!A:E}, "where Col3 = 'Xander'", 1)
I have sentences with length between 50-70 symbols in my google spreadsheet. I have to split them into two approximately equal pieces by whitespace.
for example:
"This is sentence with 5 words."
I want to get this:
"This is sentence", "with 5 words."
Is there any way to do that?
Here's the formula to do this:
=SPLIT(JOIN("",
ArrayFormula(TRANSPOSE(SPLIT(A1," "))&
if(MOD(row(INDIRECT("A1:A"&COUNTA(SPLIT(A1," ")))),3)=0,CHAR(10)," "))),CHAR(10))
change this:
A1 to cell that contains text, change it 2 times
3 to number of words in pieces
For example, this text in cell A1:
one to 3 for 5 six 7 eit nine ten will be converted into pieces:
one to 3
for 5 six
7 eit nine
ten
note that last piece contains only one word, it's the rest after all words were splited.
Edit
The key tho this formula is number of words, counted in it:
=COUNTA(SPLIT(A1," "))
To get approximate number of words in each part, use this formula:
=CEILING(COUNTA(SPLIT(A1," "))/2)
And the total formula will be:
=SPLIT(JOIN("", ArrayFormula(TRANSPOSE(SPLIT(A1," "))& if(MOD(row(INDIRECT("A1:A"&COUNTA(SPLIT(A1," ")))),CEILING(COUNTA(SPLIT(A1," "))/2))=0,CHAR(10)," "))),CHAR(10))
This formula doesn't count number of letters in sentence, so it can give not equal parts.
Also try
This formulas count number of lettets and will split the text accordingly. It might work better for big sentences.
Formula for part1, paste in B1:
=TRIM(REGEXEXTRACT(A1,REPT("[^ ]+ ",counta(SPLIT(LEFT(A1,CEILING(LEN(A1)/2))," ")))))
Formula for part2, paste in C1:
=TRIM(SUBSTITUTE(A1,B1,""))
To change "This is sentence with 5 words." to "This is sentence", "with 5 words." try:
=join(""", """,(SPLIT(JOIN("", ArrayFormula(TRANSPOSE(SPLIT(A1," "))& if(MOD(row(INDIRECT("A1:A"&COUNTA(SPLIT(A1," ")))),CEILING(COUNTA(SPLIT(A1," "))/2))=0,CHAR(10)," "))),CHAR(10))))