To create a yes or no formula in Excel, you wrap one of Excel's built-in random functions inside an IF or CHOOSE so each cell returns the text "Yes" or "No" based on a coin-flip-style draw. The two shortest patterns are =IF(RAND()<0.5,"Yes","No") and =CHOOSE(RANDBETWEEN(1,2),"Yes","No"), and both work in any version of Excel from 2007 onward without add-ins or VBA. Because Excel's RAND and RANDBETWEEN are volatile, the displayed answer changes every time the workbook recalculates, which is useful for live sampling but frustrating once you want the result to stop moving. To freeze a result you copy the cell and paste it back as a value, which strips out the formula. For one-off yes or no questions that do not belong in a spreadsheet, such as picking a restaurant, choosing who goes first, or settling a small debate, a browser tool that uses the Web Crypto API gives a stable answer that will not shift the next time the workbook recalculates, and it leaves no file behind.

Three Ways to Write a Yes/No Formula in Excel
Excel ships with two random functions that anyone can combine with logical helpers to produce a binary outcome. The first, RAND(), returns a decimal between 0 and 1 every time the sheet recalculates. The second, RANDBETWEEN(a,b), returns an integer in the inclusive range you specify, and is available in Excel 2007 and later. Pairing either with IF or CHOOSE turns a numeric draw into readable text. The three patterns below all work in a single cell and can be copied down a column for bulk sampling, and each gives a 50/50 result on a per-cell basis.
| Pattern | Example formula | How the math works |
|---|---|---|
| IF + RAND | =IF(RAND()<0.5,"Yes","No") | Compares a 0-to-1 draw to 0.5; below the threshold returns "Yes", at or above returns "No". |
| CHOOSE + RANDBETWEEN | =CHOOSE(RANDBETWEEN(1,2),"Yes","No") | Draws 1 or 2 uniformly, then returns the matching label from a two-item list. |
| IF + RANDBETWEEN | =IF(RANDBETWEEN(1,2)=1,"Yes","No") | Draws 1 or 2; equal-to-1 returns "Yes", otherwise "No". |
The underlying random source is Excel's internal pseudo-random generator, not a cryptographic one. That matters for casual sampling and decision aids, and it does not matter for spreadsheets that already use RAND everywhere else because the distributions are statistically equivalent for the small samples most users draw.
How to Build a Yes/No Formula in Excel Step by Step
If your goal is a live, recalculating yes/no value inside a cell, the procedure takes about a minute. The steps below work in Excel for Microsoft 365, Excel 2021, and Excel 2019; older versions behave the same way as long as RANDBETWEEN is available, which has been the case since Excel 2007.
- Open the workbook and click the cell where you want the first answer, for example A1.
- Type =IF(RAND()<0.5,"Yes","No") and press Enter. The cell now shows either "Yes" or "No".
- Press F9 to force a recalculation and watch the answer change. Each press picks a fresh draw from Excel's random generator.
- To fill more cells, select A1, grab the fill handle in the bottom-right corner, and drag down. Every cell gets its own independent formula and its own independent draw.
- To freeze a specific result, select the cell, press Ctrl+C, then press Ctrl+Shift+V (or use Paste Special > Values) to replace the formula with the text it was showing. The frozen value survives every future recalculation.
- To start over, press Delete on the frozen cell and re-enter the formula.
If you want a single, static draw that does not change on F9, the paste-as-value step is unavoidable inside Excel. The formula itself cannot be made non-volatile without removing the random source.
Why Excel's Random Functions Fall Short for Yes/No Prompts
Excel's RAND and RANDBETWEEN are designed to be convenient rather than auditable, and three properties tend to trip people up when the answer needs to stay still or be reviewed later. First, the functions are volatile, so any edit anywhere in the workbook, even a typo you delete in an unrelated cell, can flip the answer. Second, switching the workbook to Manual Calculation mode freezes the answer, but it also freezes every other formula in the sheet, which is rarely what you want. Third, Excel does not expose its random algorithm, so you cannot reproduce a specific draw later or prove that a particular value came from a particular seed.
For internal sampling, such as picking ten rows at random, these limits do not matter because the workbook is the system of record and the file travels with the data. For one-off decisions, however, you do not want a recalculation surprise the next time a colleague opens the file, and you do not want to remember to switch back to Automatic Calculation afterwards. If you want a deeper look at Excel's range-based random options, the random numbers within a range guide covers the same family of functions in more detail. That gap between live-cell formulas and one-off questions is the space a dedicated browser tool fills.
Use the Yes or No Generator for Stable, Auditable Answers
The Yes or No Generator is a small browser page that runs entirely in the current tab. It uses the W3C Web Cryptography Crypto.getRandomValues method, as documented on the MDN reference page for getRandomValues, to draw a single unsigned 32-bit integer and then maps even values to "Yes" and odd values to "No". Because 2^32 is exactly twice 2^31, every valid 32-bit value is accepted without rejection, and the two outcomes get precisely half of the source range each. The question you type is stored only as a local label and does not influence the draw. The question, the answer, and the visible history are never uploaded, never written to an account, and never sent to a remote service.
If Web Crypto is missing, blocked, or throws an exception, the tool reports a clear failure and produces no answer. It does not silently swap in Math.random, because changing the random source without telling you would contradict the displayed methodology and make silent failures harder to detect. That explicit-failure contract is the main reason to use the tool over a hand-rolled formula when the question matters enough to be worth opening a second tab.
| Property | Excel formula | Yes or No Generator |
|---|---|---|
| Where it runs | Inside a workbook | Any modern browser tab |
| Random source | Excel's internal PRNG | Crypto.getRandomValues |
| Changes on workbook recalculation | Yes, every F9 press | No, the displayed answer is fixed until you click again |
| Visible history of recent draws | No | Yes, newest-first, up to 20 entries |
| Requires a saved file | Yes | No, the page is self-contained |
| High-stakes decisions | Not appropriate | Not appropriate |
How to Get a Fair Yes or No From the Browser Tool
- Open the Yes or No Generator in any modern browser tab. No account, file, or network call is required.
- Optionally type a low-stakes question of no more than 1,000 UTF-16 code units into the question field. The exact boundary is accepted and one code unit beyond it fails without truncation or generation. Leave the field empty if you only need a coin flip.
- Click Generate Yes or No. The tool draws one Uint32 with Crypto.getRandomValues, maps even to "Yes" and odd to "No", and shows the current answer prominently below the button.
- Generate again as many times as you like. Each click consumes a fresh draw; the question text, the time of the last click, and the previous answer never affect the next mapping.
- Read the most recent answer from the on-screen display rather than from memory, so you do not mislabel an older result with newer wording.
The same procedure works on a phone, a tablet, or a desktop, and the only requirement is a browser that exposes Web Crypto, which every current Chrome, Edge, Firefox, and Safari build does by default.
Reading the History and Knowing When to Stop
The tool keeps a newest-first history of up to 20 draws on screen, so you can compare several answers at a glance without re-rolling manually. After the twenty-first generation, the oldest entry is removed and a message states exactly how many earlier answers have been discarded. The history is a bounded UI convenience rather than a fairness guarantee, because independent 50/50 results can naturally form streaks of repeated Yes or repeated No, and the tool does not rebalance later draws to compensate. When you are done, click Clear History to reset both the visible entries and the discarded count, and the action also removes the current answer so a stale result is not left on screen.
Editing the question clears the prominently displayed current answer and any prior error message, so an answer is never silently relabeled with new wording. History entries, however, are kept with the question text exactly as it was entered at the time of the draw, and empty questions are valid; the history simply shows the label "No question" for those entries.
None of this is appropriate for medical, legal, financial, safety-critical, emergency, security, consent, employment, eligibility, or compliance decisions. A cryptographically fair 50/50 draw does not validate the available choices, understand consequences, or supply professional judgment, and a balanced answer can still be the wrong one when the stakes are real.