Júnior Beluzzo
Júnior Beluzzo

Reputation: 1

How do I get value as text (without executing formula) in Google Sheet?

I searched the web trying to find how to solve this problem. I set this macro in Google Sheet:

spreadsheet.getCurrentCell().setValue('=IF(Dados!C10;"THIS IS " & Dados!C8; "THIS IS " & Dados!C8)');

But when the value of Dados!C8 is "01/20" I want to get the text: "THIS IS 01/20". Although, the result I get is "THIS IS 0.05". That's because It interprets as a formula, not as text.

How can I solve it?

Upvotes: 0

Views: 333

Answers (1)

ziganotschka
ziganotschka

Reputation: 26796

You need to convert the date to a string with text(), specifying the format

Sample:

=IF(Dados!C10,"THIS IS " & text(Dados!C8, "mm/dd"), "THIS IS " & text(Dados!C8, "mm/dd"))

Upvotes: 1

Related Questions