Stop Using Scatter Charts Blindly — How to Plot a Function in Excel Correctly

The first thing most people do when they need to plot a function in Excel is type a few X values in column A, manually calculate Y in column B using a calculator or mental math, then insert a scatter chart. That’s wrong — especially for functions with sharp turns, asymptotes, or periodic behavior. You’ll miss critical shape features, get jagged lines, and waste 20 minutes fixing axis scaling.

The Problem

You’re trying to visualize f(x) = (x³ − 4x) / (x − 2) for a client presentation. You grab five X values: -3, -1, 0, 1, 3. You compute Y by hand or with quick formulas — but you skip x = 2 (the discontinuity), and your step size is too coarse. The resulting chart looks like a broken line, not a rational function with a hole and oblique asymptote.

X (A1:A6)Y (B1:B6) — Hand-CalculatedWhat’s Missing
-3-3.75No warning about domain gap at x=2
-1-1.33Too few points near discontinuity
00No evaluation of limit behavior
13No negative X density below -2
315Misses vertical asymptote trend
Chart shows no hole at (2, 8)

The Solution

Do this instead. Build the function *once* in Excel — then generate 100+ precise, evenly spaced X values. Let Excel handle the math, not your head.

  1. Set up X values: In A2, enter -5. In A3, enter =A2+0.1. Drag down to A102. Now you have 101 points from -5 to 5, step 0.1.
  2. Enter the function in B2: Type =(A2^3-4*A2)/(A2-2). Press Enter. Excel returns #DIV/0! at A2=2 — that’s expected. Don’t delete it.
  3. Convert errors to blanks: Wrap the formula: =IFERROR((A2^3-4*A2)/(A2-2),""). Copy B2 down to B102.
  4. Select A2:B102, go to Insert → Charts → Scatter with Smooth Lines (Alt+N+S+P).
  5. Right-click the chart → Select Data → Edit Horizontal Axis → set Axis Options → Bounds: Min -5, Max 5.

That’s it. You now see the hole at (2,8), the oblique asymptote y = x² + 2x, and correct curvature. No guesswork.

StepActionResultShortcut
1A2 = -5; A3 = A2+0.1; drag to A102101 X-values, 0.1 spacingCtrl+D (fill down)
2B2 = IFERROR((A2^3-4*A2)/(A2-2),"")Clean Y column, blank at x=2F2 → Ctrl+Enter (edit & fill)
3Select A2:B102 → Insert → Scatter (Smooth)Accurate curve with visible holeAlt+N+S+P
4Format horizontal axis: Bounds Min=-5, Max=5No clipping, full domain contextCtrl+1 → Axis Options

Going Further

You can plot multiple functions on one chart. Add column C for g(x) = SIN(A2)*COS(A2), column D for h(x) = LN(ABS(A2)+0.1). Select A2:D102 before inserting the chart — Excel auto-adds series.

For parametric plots (e.g., circle: x=cos(t), y=sin(t)), put t in A2:A102 (-π to π), x in B2: =COS(A2), y in C2: =SIN(A2), then select B2:C102 only.

Use SEQUENCE() if you have Excel 365: In A2, type =SEQUENCE(101,, -5, 0.1). Then B2 becomes =IFERROR((A2^3-4*A2)/(A2-2),"") — no dragging needed.

Surprising tip: To highlight a discontinuity, add a data point at (2,8) manually in row 103: A103=2, B103=8, then format that marker as red diamond with no line. It visually confirms the removable discontinuity.

When NOT to Use This

Don’t use this method for functions defined only at integers (like factorial or Fibonacci). Scatter charts will connect non-sequential points and misrepresent discrete behavior. Use Column or Line charts instead — and label X-axis as text, not numeric.

Avoid plotting f(x) = TAN(x) over [-π, π] with step 0.1. You’ll hit undefined points every ~1.57 units and get huge spikes. Instead, break into intervals: [-π, -π/2), (-π/2, π/2), (π/2, π] — each in separate columns, then combine series manually.

Never plot functions with conditional logic (IF(x>0, SQRT(x), -SQRT(-x))) without testing edge cases. Excel evaluates all branches — so SQRT(-x) throws #NUM! for positive x unless wrapped properly. Always test your formula on a single cell first.

If your function involves iterative calculations (e.g., Newton-Raphson root finding), don’t plot raw outputs — they may oscillate. Smooth with moving average or use helper columns with fixed iteration counts.

Keyboard Shortcuts

ActionWindows ShortcutNotes
Insert Scatter Chart (Smooth)Alt+N+S+PP = “Smooth” — not S for “Scatter”
Open Format Axis PaneCtrl+1Works after selecting axis or chart area
Fill Down FormulaCtrl+DSelect source + destination range first
Edit Cell & Apply to SelectionF2 → Ctrl+EnterCritical for batch formula updates
Toggle Formula ViewCtrl+` (grave accent)Verify function logic before plotting
Select Contiguous Data RangeCtrl+Shift+Arrow (↓)Start in A2 → Ctrl+Shift+↓ selects A2:A102
Emily Watson

Emily Watson

Emily is an expert in workplace culture and team dynamics. Her articles help professionals navigate interpersonal challenges and build better coworker relationships.