Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Stem and Leaf Plot in Excel: Step-by-Step

· 8 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Yes, you can create a stem-and-leaf plot in Excel, but there is no built-in chart type for it. You have to build it manually using Excel’s sorting, text, and formula tools. The result is a clean, table-like display that shows every data point while also revealing the shape of the distribution. This guide walks you through the process from raw numbers to a finished plot, including how to handle two-digit stems, decimals, and negative values.

What You'll Need

  • Microsoft Excel (2016 or later works fine; the steps are the same for Excel 365 and most older versions).
  • Your data in a single column, ideally with no blank cells or text.
  • A basic understanding of what a stem-and-leaf plot is: the stem is the leading digit(s), and the leaf is the last digit. For example, in the number 42, the stem is 4 and the leaf is 2.

Step-by-Step

Step 1: Prepare your data

  1. Open Excel and enter your numbers in a single column, say column A, starting at A1. Do not include headers or labels in the same column.
  2. Make sure every cell contains a number. If you have blanks, fill them or delete the row. If you have text, remove it.
  3. Sort the data in ascending order. Select the column, go to the Data tab, and click Sort A to Z. This makes the plotting easier and ensures leaves come out in order.

Step 2: Decide on stems and leaves

  1. For whole numbers, the stem is the number without the last digit. For example, for 42, the stem is 4 and the leaf is 2. For 105, the stem is 10 and the leaf is 5.
  2. If your data has decimals, decide on a rounding or truncation rule. Usually, you round to one decimal place and then treat the digit before the decimal as the stem and the first decimal digit as the leaf. For example, 3.7 becomes stem 3, leaf 7. If you have 3.75, round to 3.8 or truncate to 3.7—be consistent.
  3. If you have negative numbers, the stem is still the leading digit(s) but with a minus sign. For -23, stem is -2 and leaf is 3. Excel will sort these correctly, but you need to handle the minus sign in formulas.

Step 3: Create a helper column for stems

  1. In column B, next to your data, enter a formula to extract the stem. For whole numbers, use: =INT(A1/10) if your data is in A1. This divides by 10 and removes the decimal part. For 42, it gives 4.
  2. For decimals, you might use =INT(A1*10)/10 to get the stem as the number with one decimal place, but that is not a true stem. Better: use =INT(A1) for the integer part as the stem, and then use the first decimal digit as the leaf. For 3.75, stem = 3, leaf = 7 (if you truncate).
  3. For negative numbers, =INT(A1/10) works because INT rounds down, so -23/10 = -2.3, INT gives -3, which is wrong. Use =ROUNDUP(A1/10,0)-1 or simply use =TRUNC(A1/10) which truncates toward zero, giving -2. Test with your data.

Step 4: Create a helper column for leaves

  1. In column C, enter a formula to extract the leaf. For whole numbers, use =MOD(A1,10). This gives the remainder after dividing by 10. For 42, it gives 2.
  2. For decimals, if you truncated to one decimal place, you can use =MOD(ROUND(A1,1)*10,10) but that can be messy. Simpler: use =VALUE(RIGHT(TEXT(A1,"0.0"),1)) to get the first decimal digit as a number. For 3.75, TEXT gives "3.8" (if rounded), RIGHT gives "8", VALUE makes it 8.
  3. For negative numbers, MOD returns a positive remainder, so -23 MOD 10 = 7. That is not what you want. Use =ABS(MOD(A1,10)) to get the absolute remainder, so -23 gives 3.

Step 5: Build the stem list

  1. In a new area, say column E, list all unique stems from column B in ascending order. You can copy column B, paste it, then use Data > Remove Duplicates.
  2. Alternatively, use the UNIQUE function if you have Excel 365: =SORT(UNIQUE(B:B)) in cell E1. This automatically lists unique stems sorted.
  3. If you have a small dataset, you can type the stems manually, but using formulas is more accurate.

Step 6: Concatenate leaves for each stem

  1. In column F, next to each stem, you want to show all leaves for that stem in a single cell, separated by spaces or just concatenated.
  2. Use a formula that checks each row in your data and collects leaves. For Excel 365, use =TEXTJOIN(" ",TRUE,IF($B$1:$B$100=E1,$C$1:$C$100,"")) as an array formula. Press Ctrl+Shift+Enter if you are not on Excel 365.
  3. For older Excel, you can use a helper column with a running concatenation, or use a PivotTable. The simplest is to use the CONCATENATE function manually if you have few data points, but that is tedious.
  4. Another method: create a pivot table with stems as rows and leaves as values, but you need a way to concatenate. The TEXTJOIN approach is the cleanest.

Step 7: Format the plot

  1. Select the stem and leaf columns (E and F).
  2. Go to Home > Format as Table or just apply borders to make it look like a table. Add a header row with "Stem" and "Leaf".
  3. Adjust column widths so the leaves are visible. You may want to increase the row height if leaves wrap.
  4. To make it look like a proper stem-and-leaf plot, you can put a vertical line between the stem and leaf. In the leaf cell, you could add a leading space or a pipe symbol, but that is optional.

Step 8: Verify your plot

  1. Check that every data point appears exactly once in the plot. For each stem, count the leaves and compare to the frequency of that stem in your data.
  2. Ensure leaves are in ascending order. If you sorted your data in Step 1, leaves will automatically be in order because you concatenated them in the order they appear.
  3. If you have a large dataset, double-check the TEXTJOIN formula covers all rows. Adjust the range if needed.

Common Mistakes

  • Using the wrong stem for negative numbers: Excel’s INT function rounds down, so -23/10 gives -3 instead of -2. Always test with negative values and use TRUNC or a custom formula.
  • Leaves out of order: If you do not sort your data first, the leaves will appear in the original order, which defeats the purpose. Always sort ascending before extracting stems and leaves.
  • Ignoring decimal places: If your data has decimals and you treat them as whole numbers, you will get incorrect stems and leaves. Decide on a rounding rule and apply it consistently.
  • Blank cells: Blank cells in the data range will cause formulas to return errors or skip values. Clean your data first.
  • Using MOD for negative numbers: MOD returns a positive remainder, so -23 MOD 10 = 7. Use ABS(MOD(...)) to get the correct leaf.

Tips

  • Use a separate sheet for the plot to keep your raw data clean.
  • For large datasets, use a PivotTable to group by stem and then use a macro to concatenate leaves, but the TEXTJOIN method is simpler for most users.
  • If you have many stems, consider using a two-digit stem (e.g., for numbers 100-199, stem = 10, leaf = 0-9). This reduces the number of rows.
  • Add a title and axis labels if you plan to present the plot. You can insert a text box above the table.
  • Use conditional formatting to highlight certain leaves, like outliers, but that is not standard.

Troubleshooting

If the TEXTJOIN formula returns #VALUE! or #NAME? That means your Excel version does not support TEXTJOIN. Use the CONCATENATE function with IF in an array formula, or use a helper column that builds the string step by step. For example, in D1, enter =IF(B1=E$1, C1, "") and drag down, then use =CONCATENATE(D1,D2,...) but that is manual. Alternatively, upgrade to Excel 365.

If leaves are not in ascending order within a stem, your data was not sorted. Re-sort the entire data range by column A. If you have duplicate stems, they will be grouped automatically.

If stems appear out of order, check the UNIQUE and SORT functions. If you typed stems manually, ensure they are in ascending order. Use the SORT function to fix.

If you see #DIV/0! or other errors, check for blank cells or text in your data range. Remove them and recalculate.

If your plot looks too wide, consider splitting the leaves into two lines or using a smaller font. You can also use a two-digit leaf for very large datasets.

Frequently Asked Questions

Can I create a stem-and-leaf plot with a built-in Excel chart?

No. Excel does not have a native stem-and-leaf chart type. You must build it manually as described, or use a third-party add-in.

How do I handle numbers with more than two digits?

For numbers like 123, the stem is 12 and the leaf is 3. Use =INT(A1/10) for the stem and =MOD(A1,10) for the leaf. This works for any integer.

What if my data has negative numbers?

Use =TRUNC(A1/10) for the stem (truncates toward zero) and =ABS(MOD(A1,10)) for the leaf. For -23, stem = -2, leaf = 3. Test with your data.

How do I show decimals in a stem-and-leaf plot?

Round or truncate to one decimal place. Then use the integer part as the stem and the first decimal digit as the leaf. For example, 3.75 becomes stem 3, leaf 8 if you round to 3.8, or leaf 7 if you truncate. Be consistent.

Can I create a stem-and-leaf plot in Google Sheets?

Yes, the same logic applies. Google Sheets has TEXTJOIN and UNIQUE functions, so the formulas work similarly. The steps are almost identical.

Is there a way to automate the process for a large dataset?

You can use a PivotTable to group by stem and then use a macro (VBA) to concatenate leaves, but that requires programming. The TEXTJOIN method works for up to thousands of rows.