Chart & Visualization Issues

How to Create a Stacked Bar Chart for Value Counts of 1, 2, and 3

Emma BrownEmma Brown Nov 11, 2026 868 views

Question details

The user needs to summarize a column containing the values 1, 2, and 3, and visualize the counts as a stacked bar chart with different colors for each value segment.

How to Create a Stacked Bar Chart for Value Counts of 1, 2, and 3
Product
Spreadsheets
Device & OS
not provided
Scenario
Visualizing the frequency of specific numeric values from a dataset into a single stacked bar format for quick comparison.
Observed behavior
The goal is to generate a summary table counting the occurrences of 1, 2, and 3, and then produce a stacked bar chart reflecting these counts with custom segment colors like green, blue, and yellow.
Before you start

Ensure your dataset is organized in a single column without empty rows interrupting the data, and locate a blank area in your worksheet to create the necessary summary table.

Solution 1Recommended

Use COUNTIF Formulas and Insert a Stacked Bar Chart

Create a summary table to calculate the frequency of each value using the COUNTIF function, then use this structured data to generate and format a stacked bar chart.

A stacked bar chart requires aggregated data to display segments correctly. By using the COUNTIF function, you can automatically calculate how many times each specific value appears in your dataset, creating the perfect foundation for your chart.

1
Create a summary table

Set up a new table in your worksheet. Dedicate one row for your data source and create separate columns with headers for the values 1, 2, and 3.

2
Calculate counts with COUNTIF

In the cell under the header '1', enter the formula =COUNTIF(A:A,1) (assuming your raw data is in column A). Repeat this process for '2' with the formula =COUNTIF(A:A,2) and for '3' with =COUNTIF(A:A,3).

3
Insert the Stacked Bar Chart

Select your newly created summary table, including the headers. Go to the 'Insert' tab on the top ribbon, click on 'Bar Chart', and select the 'Stacked Bar' option.

4
Customize segment colors

Click on individual chart segments to select a specific data series. Right-click and choose 'Format Data Series' to change the fill color. For example, set the segment for 3 to green, 2 to blue, and 1 to yellow.

Use COUNTIF Formulas and Insert a Stacked Bar Chart
Dynamic Chart Updates: Because the chart is linked directly to COUNTIF formulas, your stacked bar chart will automatically update its segment sizes if you add, remove, or change the 1, 2, and 3 values in your original source column.
Professional Data Visualization

Create Professional Stacked Bar Charts in WPS Spreadsheet

WPS Spreadsheet provides powerful data analysis tools, including the COUNTIF function and a wide variety of customizable charts. Easily summarize your data and create stunning stacked bar charts to visualize value distributions seamlessly.

  1. 1. Open your dataset in WPS Spreadsheet: Launch WPS Office and open your spreadsheet containing the column of raw values.
  2. 2. Apply the COUNTIF function: Set up a summary table horizontally and use the =COUNTIF() formula to count the occurrences of 1, 2, and 3.
  3. 3. Insert Stacked Bar Chart: Highlight the summary table, navigate to the Insert tab, click Chart, and select the Stacked Bar chart type.
  4. 4. Customize Colors: Double-click the chart segments to open the formatting pane on the right and apply your preferred custom colors to each series.
Fully compatible with Microsoft Excel (.xlsx) formats and chart types.Intuitive chart insertion and formatting interface for quick styling.Built-in robust formula engine supporting COUNTIF and other statistical functions.Free, lightweight, and fast office suite for Windows, Mac, and Linux.
microsoft office alternative - wps office

Frequently Asked Questions

Can I use this method for text values instead of numbers 1, 2, and 3?

Yes. The COUNTIF function works perfectly with text criteria. Simply replace the number in the formula with your text enclosed in quotation marks, such as =COUNTIF(A:A,"Completed").

Why is my stacked bar chart showing multiple separate columns instead of a single stacked bar?

This usually happens if your summary table is oriented vertically instead of horizontally. Ensure your values (1, 2, 3) are set as column headers across a single row. Alternatively, you can click 'Switch Row/Column' in the Chart Design tab to fix the orientation.

How can I add data labels to show the exact count on each color segment?

Click on your stacked bar chart to select it, then click the '+' (Chart Elements) icon that appears next to the chart. Check the box for 'Data Labels' to display the numerical counts inside each colored segment.

Will the COUNTIF formula work if I have empty cells in my data column?

Yes, the COUNTIF formula specifically targets the exact criteria you set (such as 1, 2, or 3) and will automatically ignore any blank cells in the referenced column.