O
O
Old_disciple2021-02-02 08:15:28
Google Sheets
Old_disciple, 2021-02-02 08:15:28

How to add spaces and parentheses to a formula?

Dear experts, tell me what I'm doing wrong with the formula, and how to fix it?
The bottom line is this: I used the
addition " NUMBERTEXT ", but I can't figure out what I'm doing wrong:

="Total including all : "&D8 & MONEYTEXT(D8; "RUB")

With this formula, the output is:
Total from everything: 1000.35 One thousand rubles thirty-five kopecks

D8
this is a cell with a value.
How would you like to see the result:
Total from everything: 1000.35 (one thousand) rubles 35 kopecks

How to add spaces and enclose the amount in words in brackets, while putting pennies outside the brackets?
Thank you.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Ivanov, 2021-02-02
@Old_disciple

Unfortunately, the regular expression interpreter on which this program is based does not support nested calls. Therefore, you need to parse the string yourself and connect it as needed.

="Итого с учетом всего : " & TEXT(D8;"#,##0.00") & REGEXREPLACE(
  MONEYTEXT(D8;"RUB") & " ноль копеек ";
  "(.*)\s(руб[а-я]+)(.*?)(коп[а-я]+)(.*)";
  " ($1) $2 " & TEXT(ROUND(MOD(D8;1);2)*100;"00") & " $4"
)

6022a4496d118990363140.png
Remark . The representation of the text of currencies is determined by the general format of the interpreter and the vision of the development team and does not support any banking or other standards. The main reason is the lack of support in product development. Time and effort is only enough to fix bugs.

Updated
Suggest https://t.me/googleappsscriptrc/35292 a slightly more humane formula for human eyes to get the number of kopecks
="Итого с учетом всего : " & D8 & " " & REGEXREPLACE(
  MONEYTEXT(D8; "RUB");
  "(.*?)\s(руб[а-я]{0,})[\s].*?(коп[а-я]{0,})";
  "($1) $2 " & REGEXEXTRACT("" & D8;",(\d{2})") & " $3"
)

I
iBird Rose, 2017-07-29
@leave_me_here

.tit > i {display: inline-block; vertical-align: middle; width: 15px;}

A
Alexander Petrov, 2017-07-30
@Mirkom63

Why not put the text in another div?
Set i to display:block. give them float:left and align them as you want.
but for the parent, don't forget to set overflow:hidden or reset the alignment.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question