To solve for an unknown number x in Excel, put x in an input cell, calculate the result in another cell, then choose Data > What-If Analysis > Goal Seek and set the result cell to your target. If you mean locating the letter “x” in worksheet text, press Ctrl+F and search for it. These are different tasks, so use the steps below that match what you need.
Goal Seek is useful when you know the result you want but not the input needed to produce it. For example, it can find x in an equation such as 3x + 5 = 26. Excel changes one input cell until a formula reaches your target. It does not display a symbolic algebra solution; it calculates a numeric answer. The guide is for Excel for Microsoft 365 on Windows, with notes for Mac and Excel for the web.
What You’ll Need
- An Excel workbook with a cell for the unknown value and a formula cell that calculates the result.
- A target result, such as 26 in the equation 3x + 5 = 26.
- Excel for Microsoft 365 desktop if you want to use Goal Seek. Excel for the web does not provide the desktop What-If Analysis Goal Seek command; open the workbook in the desktop app to use it.
Step-by-Step
- Choose the task you mean by “find x.” Use Goal Seek to calculate an unknown numeric input in a formula. Use Find to locate a literal x character, word, or value already in the workbook. Use the FIND function when you need the character position of x inside text, for example to split or inspect a text value. Goal Seek, Find, and the FIND function solve different problems.
- Set up the unknown and result cells for Goal Seek. For the equation 3x + 5 = 26, enter a label such as x in A1 and a starting guess such as 1 in A2. Put a label such as Result in B1. With the unknown value in A2, enter this formula in B2:
=3*A2+5. The cell references A2, so its result changes whenever the value of x changes. With A2 initially equal to 1, B2 displays 8. - Check that the result formula represents the problem. Before asking Excel to find a value, check the operators, cell references, and units. The formula in B2 must calculate the left side of the equation, not a number typed in by hand. For this example, a result of 26 means that 3 times x plus 5 equals 26. If the formula is wrong, Goal Seek can still find an input that makes the wrong calculation hit 26.
- Open Goal Seek. Select the Data tab on the ribbon, then choose What-If Analysis > Goal Seek. In Excel for Microsoft 365 on Windows, What-If Analysis is in the Forecast group on the Data tab. Excel for Mac also has Goal Seek under Data > What-If Analysis. If you do not see the command in the web app, open the file in desktop Excel.
- Fill in the Goal Seek dialog box. In Set cell, enter or select B2, the cell containing the formula. In To value, type 26, the desired result. In By changing cell, enter or select A2, the input cell Excel is allowed to adjust. Goal Seek requires the Set cell to contain a formula, and the changing cell must affect that formula. You can click a field and then select its cell on the worksheet.
- Run the calculation and accept the result. Click OK. Excel adjusts A2 and recalculates B2. For this example, it should find x = 7, because 3 × 7 + 5 = 26. Excel may report that it found a solution; choose OK in the result message to keep the values, or Cancel to restore the values from before the attempt. Check A2 and B2 on the sheet rather than relying only on the dialog message.
- Verify the answer independently. Confirm that B2 displays 26 and that A2 is approximately 7. If rounding or more complex formulas are involved, a small difference can occur because Excel uses iterative numerical calculations. You can increase the displayed decimal places for inspection, but formatting changes what you see, not the stored value. For a simple equation such as this one, the expected answer is exactly 7.
- Use Find to locate a typed x instead. Press Ctrl+F on Windows, type x in the search box, and choose Find Next or Find All. In the Find dialog, expand Options if needed. Choose whether to search within the current sheet or the entire workbook, and set Look in to Values or Formulas depending on what you want to inspect. Values searches displayed cell results; Formulas can find x written inside a formula. On Mac, use Command+F. In Excel for the web, Ctrl+F or the browser interface can search worksheet content, though available search options may differ.
- Use a formula to return x’s position in text. If A2 contains text and you need the character position of a lowercase x, put this formula in another cell:
=FIND("x",A2). For example, if A2 contains “box,” the result is 3 because x is the third character. FIND is case-sensitive, so it will not find uppercase X when you search for lowercase x. To make the search case-insensitive, use SEARCH instead: with the same text in A2, enter=SEARCH("x",A2). Both functions return a position number, not the text before or after x.
Common Mistakes
Putting a number in Set cell instead of a formula. Goal Seek needs a formula whose result can change. If you select a cell containing a fixed number or a typed target, Excel has nothing to recalculate. Move the calculation into a formula cell and choose that cell as Set cell.
Choosing the wrong changing cell. The By changing cell field should contain the unknown input, not the output formula or an unrelated cell. If changing A2 does not alter B2, check the formula references. For example, a formula that accidentally refers to A3 will not respond when Goal Seek changes A2.
Expecting Goal Seek to solve for several unknowns at once. Goal Seek adjusts one changing cell to achieve one target value in one formula cell. For multiple decision variables or more complicated constraints, Solver may be more suitable if it is available and enabled in your Excel installation. For an equation that has multiple possible roots, Goal Seek may return only one result, depending on its starting value.
Confusing a displayed value with the stored value. A cell formatted to show zero decimal places might display 7 even if its stored value is 6.9999. Increase the displayed decimals or inspect the formula bar before deciding whether the answer meets your required accuracy. Avoid rounding the input or intermediate formula unnecessarily.
Searching in the wrong place or for the wrong kind of content. A search limited to the current sheet will not find a match on another sheet. Searching values will not necessarily locate text that appears only within a formula, and searching formulas may not match the displayed result you see. Review the Find options when a search appears to miss an obvious match.
Tips
- Start the changing cell with a reasonable guess. For a linear equation, almost any starting value may work, but for formulas with powers, percentages, or several possible answers, a guess near the expected result can affect which solution Goal Seek finds.
- Keep the input cell separate from the formula cell. Clear labels such as Unknown, Target, and Calculated result make it easier to select the correct cells and revisit the calculation later.
- Write the equation in terms of cell references. That makes the model easy to inspect and lets Goal Seek recalculate it. For example, if a tax rate, quantity, or price is part of the calculation, give each input its own cell rather than burying changing assumptions in a long formula.
- Save a copy before experimenting with important figures. Goal Seek changes the input cell and does not create a separate record of its earlier value. Undo may reverse the change in desktop Excel, but a saved copy makes comparisons safer.
- For text searches, use Find All when you need to review every match rather than jumping through them one at a time. Use Match case or Match entire cell contents in Options when partial matches or letter case matter.
- Remember that FIND returns a position counted from 1, not a zero-based index. If it returns 1, the x is the first character. If the searched character is absent, FIND returns #VALUE!, which is an error rather than a position.
Troubleshooting
Goal Seek says it cannot find a solution. Confirm that the selected Set cell contains a formula, that the changing cell is an input rather than a formula, and that the formula refers to that input. Check whether the requested target is mathematically possible. For example, if the formula can only produce positive values, a negative target cannot be reached by changing the input.
The result is close but not exact. Goal Seek uses numerical iteration and may stop within a tolerance rather than producing an exact displayed match. Check the underlying value with more decimal places. If greater precision is essential, review the calculation and consider whether a direct algebraic formula can calculate the unknown exactly. Also check Excel’s calculation settings if formulas are not updating as expected.
Goal Seek gives a surprising answer. Try a different starting value in the changing cell and run Goal Seek again. Nonlinear equations can have more than one solution, and a starting value can steer the calculation toward a different one. Verify each candidate in the original equation and decide which solution fits the real problem.
Find reports no matches. Expand Options and check the current search scope, the Look in setting, Match case, and Match entire cell contents. If the letter is part of a formula, search in Formulas; if it appears as a displayed cell value, search in Values. Clear any filters or restrictions that could be hiding the cells you expect to find.
The FIND formula returns #VALUE!. Check that the searched text really contains the exact character and that the reference points to the correct cell. FIND distinguishes lowercase x from uppercase X. If either case should match, use SEARCH. If missing text is expected, you can display a message instead: with the text in A2, enter =IFERROR(FIND("x",A2),"Not found"). This returns the character position when found and the words Not found when it is absent.
Frequently Asked Questions
Is there an X function in Excel?
No. Excel does not have a general-purpose X function that solves any equation. Goal Seek can calculate one unknown numeric input for a formula, while Find and the FIND function handle locating text.
How do I solve x in an equation such as 2x + 4 = 18?
Put a starting value for x in one cell, calculate 2 times that cell plus 4 in another cell, then use Goal Seek to set the formula cell to 18 by changing the input cell. The result is x = 7, since 2 × 7 + 4 = 18.
Can Goal Seek find more than one value for x?
It changes one input cell and returns one result per run. If the equation has multiple solutions, repeat it with different starting values and check the results. Goal Seek does not list every root automatically.
Can I use Goal Seek in Excel for the web?
The desktop Goal Seek command is not available in Excel for the web. Open the workbook in Excel for Microsoft 365 desktop on Windows or Mac to use Data > What-If Analysis > Goal Seek. You can still use basic worksheet search in the web app.
What is the difference between FIND and SEARCH?
Both return the position of one text string inside another. FIND is case-sensitive; SEARCH is not. Neither solves a numeric equation, and both return an error if the requested text is not present.
How do I find lowercase x but not uppercase X in a worksheet?
Press Ctrl+F on Windows or Command+F on Mac, open Options, and enable Match case before searching for lowercase x. Set the search scope and Look in option to match where the text is stored.
Related
- Inserting a Line in Word: Rules, Borders, and Shapes
- Hanging Indent in Word: How to Insert and Adjust
- Cover Page in Word: How to Insert, Edit, and Remove It
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Insert a Personal Signature in Word 365To insert a personal signature in Word 365, scan or photograph your handwritten signature, then choose Insert >…
- How to Present PowerPoint and See Your Speaker NotesTo present a PowerPoint while keeping your notes visible, connect a second display, set Windows to extend the…
- How to Remove Merged Cells in Google SheetsTo remove merged cells in Google Sheets, select a merged cell or range, then choose Format > Merge…
- Clear Cache on the Outlook App: Safe Steps by DeviceTo clear the Outlook app’s cache, use the method for your device: on Android, open Settings > Apps…
- Personal Distribution Lists in Outlook: Create and ManageTo create a personal distribution list in Outlook, open People or Contacts, choose the option to make a…
- Excel Data Validation: Lists, Rules, and Common FixesIn Microsoft Excel for Microsoft 365 on Windows, data validation controls what users can enter in selected cells.…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.