DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk4 min

How to Build a Simple Game in Excel With Formulas and Conditional Formatting

Create a beginner-friendly Excel guessing game with a target cell, a guess cell, an IF feedback formula, and conditional formatting for low, high, and correct states.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build a simple Excel guessing game with three cells: one for a target number, one for the player’s guess, and one for feedback. An IF formula can report whether the guess is too low, too high, or correct; conditional formatting can color each message. For a first version, enter the target manually so it stays fixed while the player guesses.

Set up the game board

In a blank worksheet, use these labels and cells. The example uses a target of 42; choose any whole number you like.

As an Amazon Associate I earn from qualifying purchases.

Cell Label or value Purpose
A2 Target Identifies the number to guess.
B2 42 The target number. Keep it visible for setup, or hide the row or column after testing if you want the player not to see it.
A3 Your guess Identifies the player’s input.
B3 (player enters a number) The cell where the player types each guess.
A4 Feedback Identifies the result.
B4 Formula Displays whether the guess is correct, too low, or too high.

Excel formulas begin with = and can use cell references and built-in functions. See Microsoft’s overview of formulas in Excel for the basics.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Write the feedback formula

Click B4 and enter:

=IF(B3=B2,"Correct",IF(B3<B2,"Too low","Too high"))

The outer IF first checks whether the guess equals the target. If not, the nested IF checks whether it is less than the target. A guess that is neither equal nor lower must be higher, so the final result is “Too high.” Excel’s conditional-formula guide explains how IF returns a result based on a logical test.

#1 Best Overall
Sale
Microsoft Excel Laminated Two-Sided Keyboard Shortcut Guide - Windows Edition
  • Over 215 Microsoft Windows Excel Shortcuts
  • Two-Sided Durable Laminiated Sheet
  • Designed for Excel on a Windows Computer

Try entering 30 in B3: B4 should show “Too low.” Enter 50 and it should show “Too high.” Enter 42 and it should show “Correct.” These checks confirm the three logical outcomes before you add colors.

Color the game states with conditional formatting

Create a rule for each feedback message so the result is easy to scan. In Excel for Windows or Mac, select B4, then use Home > Conditional Formatting > Highlight Cells Rules > Text that Contains. Enter the text for a state, choose a format, and confirm. Repeat for “Too low” and “Too high,” choosing a distinct fill or font color for each. Menu wording and steps can differ by platform; Microsoft’s guide includes separate instructions for desktop Excel and Excel for the web.

Rank #2
Sale
Microsoft Surface Pro Keyboard with Pen Storage, Compatible with Copilot+ (11th Edition), Surface 9 and 8, Alcantara Material, Black
  • Instant Copilot. Unlock new possibilities with the dedicated Copilot key, which gives you instant access to experiences that can enhance your productivity¹.
  • Enhance your experience With the new microphone mute key and snipping key
  • Full keyboard experience. Features a full mechanical keyset, backlit keys, and a large trackpad for precise navigation and control. Optimal key spacing allows fast, fluid typing.
  • Slim and compact Performs like a traditional, full-size keyboard.
  • Clicks in place instantly Use in combination with the Surface Pro (11th Edition), Pro 9 and Pro 8* kickstand for a perfect laptop experience anywhere.

For exact matching, or to apply a formula-based rule, create a new conditional-formatting rule and use a formula that evaluates to TRUE or FALSE. With B4 as the selected cell, example rules are:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • =$B$4="Correct"
  • =$B$4="Too low"
  • =$B$4="Too high"

Choose a format for each rule and make sure the “Applies to” range covers B4. If you extend the game to multiple rows, adjust the references to match the first cell in the range; absolute and relative references determine how Excel applies a rule across cells. Check rule precedence if rules overlap. Microsoft also notes that errors in cells can stop conditional formatting from applying and recommends using functions such as IS or IFERROR where appropriate. See Use conditional formatting to highlight information in Excel for rule setup and reference behavior.

Rank #3
Pixiecube Excel Cheat Sheet Desk Pad | Excel Shortcut Keys Mouse Pad | Extended Large XL Gaming Mousepad | PC Office Spreadsheet Keyboard Mat | Non-Slip Stitched Edge
  • EXCEL SHORTCUTS. ZERO SEARCHING. – Our bestselling reference mat puts an extensive collection of commonly used commands, formulas and helpful tricks directly beneath your fingertips so you can find answers fast, work smarter and stay in the flow.
  • YOUR DESK. SMARTER. – Clearly organized sections for navigation, selection, formatting, data and functions make it easy to find the right Excel command exactly when you need it.
  • LEARN, WORK & RESET – Built-in desk-exercise diagrams give you 10 quick ways to stretch, recharge and return to work feeling sharper.
  • ROOM TO WORK & CREATE – The extended 31.5 x 11.8-inch Pixiecube desk mat fits a laptop or keyboard and mouse, while the soft 2 mm surface adds comfort and protects your desktop.
  • BUILT FOR REAL-WORLD WORKDAYS – A rugged stitched edge helps prevent fraying, and the water-resistant, stain-resistant surface protects against scratches, spills and everyday wear—because smarter desks should work harder.

Decide whether the target should be fixed or random

Fixed target: simplest for a first game

Type a number directly into B2 and leave it there for the round. This keeps the comparison stable while the player changes B3. When you want to start another round, replace B2 with a new target and clear B3.

Random target: useful, but it changes on recalculation

To generate an integer from 1 through 100, enter =RANDBETWEEN(1,100) in B2. Microsoft’s RANDBETWEEN reference states that the function returns a random integer between its bottom and top arguments and generates a new value whenever the worksheet recalculates. That includes recalculation caused by changes elsewhere in the sheet or by pressing F9. In a live game, the target can therefore change while the player is guessing.

Rank #4
Sale
Incase Wired Keyboard 600 – Designed by Microsoft – Spill Resistant, Quiet Touch Keys, Plug and Play, 4 Hotkeys, Windows Start Key – Black
  • Efficient Media Controls: The Wired Keyboard 600, designed by Microsoft, features a Media Center with four hot keys for easy control of play/pause, volume up, volume down, and mute functions.
  • Quiet and Responsive Keys: Enjoy a comfortable typing experience with quiet, thin-profile keys that are both responsive and efficient.
  • Convenient Shortcuts: Quickly access common tasks with dedicated shortcut keys, including a calculator hot key and a Windows start screen key.
  • Spill-Resistant Design: Work confidently with a spill-resistant design that protects your keyboard from accidental messes.
  • Plug-and-Play Simplicity: No software needed—just connect the keyboard to your PC and start using it right away, with a full number pad for efficient data entry.

If you want a random target but a stable round, generate it when starting the round and then preserve that value instead of leaving a recalculating formula in B2. One simple manual approach is to copy B2 and paste it back as a value before play; when starting the next round, enter the random formula again, then preserve its result. This avoids macros and makes the reset deliberate.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Add an optional attempt counter

For a small extension, use A5 for “Attempts” and B5 for the count. If each guess is entered into a new row, you can keep a running history and count the guesses. For example, put each guess in B3, B4, and subsequent rows, then use a count formula in the counter cell. This changes the layout, so move the feedback formula to a separate column and reference the target cell for each guess. The core game does not need an attempt counter; keeping the first version to one guess cell and one feedback cell makes it easier to follow and reset.

Best Value
SYNERLOGIC Microsoft Word/Excel (for Windows) Reference Guide Keyboard Shortcut Sticker, Laminated, No-Residue Vinyl (White/Small)
  • 💻 ✔️ EVERY ESSENTIAL SHORTCUT - With the SYNERLOGIC Reference Keyboard Shortcut Sticker, you have the most important shortcuts conveniently placed right in front of you. Easily learn new shortcuts and always be able to quickly lookup commands without the need to “Google” it.
  • 💻✔️ Work FASTER and SMARTER - Quick tips at your fingertips! This tool makes it easy to learn how to use your computer much faster and makes your workflow increase exponentially. It’s perfect for any age or skill level, students or seniors, at home, or in the office.
  • 💻 ✔️ New adhesive – stronger hold. It may leave a light residue when removed, but this wipes off easily with a soft cloth and warm, soapy water. Fewer air bubbles – for the smoothest finish, don’t peel off the entire backing at once. Instead, fold back a small section, line it up, and press gradually as you peel more. The “peel-and-stick-all-at-once” method only works for thin decals, not for stickers like ours.
  • 💻 ✔️ Compatible and fits any brand laptop or desktop running Windows 10 or 11 Operating System.
  • 💻 ✔️ Original Design and Production by Synerlogic Electronics, San Diego, CA, Boca Raton, FL and Bay City, MI, United States 2020. All rights reserved, any commercial reproduction without permission is punishable by all applicable laws.

Test and reset a round

  1. Enter a target in B2 and the feedback formula in B4.
  2. Type a number below the target in B3 and confirm the low message and its formatting.
  3. Type a number above the target and confirm the high message and its formatting.
  4. Type the target itself and confirm the correct message and its formatting.
  5. To reset a fixed-target round, replace B2 with the next target and clear B3. To reset a random-target round, generate a new value and preserve it as described above before accepting guesses.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.