Search code examples
excelexcel-formulatextformattingcell

EXCEL randbetween- text representation - clarification


I have made a simple coin toss in EXCEL, and understands what the formula does and what the outcome may be.

=TEXT(RANDBETWEEN(0;1);"""HEAD"";;""TAILS""")

Can someone explain what all the double/triple qoutes does?

Below would be a more logical way to do it for me

=TEXT(RANDBETWEEN(0;1);"HEAD";"TAILS")

Need an explanation for a formula.


Solution

  • This is the logic of the TEXT function.

    • Argument 1: RANDBETWEEN returns either 0 or 1.
    • Argument 2: A String of formatting the input according to the cell format custom rules for positive,negative and zero values.
      Since it must be a string the first and last quote means that this is a string. Within it all quotes must be doubled.