COINFLIP Function in Google Sheets

We can use the COINFLIP function (undocumented) or the RANDBETWEEN function to simulate a coin flip in Google Sheets.

In coin flipping (or coin tossing), you can choose heads or tails before the toss, but the result is random and determined by which side lands face-up when the coin is tossed into the air.

However, in Google Sheets, the function will return one of two values: TRUE or FALSE. You can choose either one for random decision-making.

COINFLIP() is currently undocumented, and be aware that such functions can change or disappear in future updates. Therefore, instead of relying solely on COINFLIP(), I’ve provided another option using RANDBETWEEN().

COINFLIP Function in Google Sheets

Syntax:

COINFLIP()

The COINFLIP function doesn’t have any arguments. You enter it in a cell to get a random boolean value.

Example:

=COINFLIP()

This function will recalculate when you reopen the sheet or make changes to the sheet. It’s a volatile function.

You can change the sheet’s recalculation settings for all volatile functions from the File menu under Settings if you wish. Here is a related tutorial: Frequency of Recalculation for Volatile Functions in Google Sheets.

Real-world Applications of the COINFLIP Function in Google Sheets

I highly suggest using the COINFLIP function in combination with the IF function in Google Sheets. The logical expression in the IF will be the COINFLIP formula, as shown below:

=IF(COINFLIP(), "Heads", "Tails")

How to Use It:

  • Enter the formula in a cell, for example, cell B1.
  • To simulate a coin flip, trigger a recalculation by entering any value in another cell.

Formula Breakdown

The combination of the IF and COINFLIP functions follows the syntax: IF(logical_expression, value_if_true, value_if_false).

Where:

  • logical_expression: COINFLIP()
  • value_if_true: “Heads”
  • value_if_false: “Tails”

The logical expression (COINFLIP()) returns a random Boolean value. If it’s TRUE, the formula will return “Heads”; otherwise, it will return “Tails”.

Coin Tossing Using the RANDBETWEEN Function

In this approach, we will replace the COINFLIP function with the RANDBETWEEN function as the logical expression in the IF function:

=RANDBETWEEN(0, 1)

The RANDBETWEEN formula returns a random number, either 0 or 1, where 1 is equivalent to TRUE and 0 is equivalent to FALSE. So, the coin toss formula here will be:

=IF(RANDBETWEEN(0, 1), "Heads", "Tails")

To flip the coin, trigger a recalculation by entering any value in another cell.

Resources

Here are a few more resources regarding the use of random values in Google Sheets:

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Hierarchical Numbering Sequences in Excel

Creating hierarchical numbering sequences in an Excel spreadsheet can significantly improve the way you...

How to Easily Repeat a Sequence of Numbers in Excel

Excel offers multiple ways to accomplish tasks, and the simplicity of each approach depends...

Create a Sequence of Dates at Every Nth Row in Excel (Dynamic Array)

Would you like to create a sequence of dates in every nth row in...

XMATCH Row by Row: Finding Values Across a Range in Google Sheets

Using the BYROW function with XMATCH in Google Sheets allows us to match values...

More like this

XMATCH Row by Row: Finding Values Across a Range in Google Sheets

Using the BYROW function with XMATCH in Google Sheets allows us to match values...

Limit Formula Expansion to a Specific Row in Google Sheets

In this tutorial, I’ll explain how to limit the expansion of an array formula...

3-D Referencing Structured Data Tables in Google Sheets

When you have several tables within a single sheet—not across multiple sheets in a...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.