How to Switch X and Y Axis in an Excel Histogram

Charts & pivot tables · Updated November 21, 2026

Excel’s built-in Histogram chart does not have a direct command to swap its horizontal and vertical axes. To put the bins on the vertical axis and the counts on the horizontal axis, make a small frequency table and insert a horizontal bar chart instead. If you only want to change the histogram’s bin intervals, you can do that on the chart’s horizontal axis without rebuilding it.

The steps below are for Microsoft Excel for Microsoft 365 on Windows. The workaround preserves the histogram’s essential information—intervals and frequencies—but uses a bar chart because Excel’s Histogram chart has a fixed orientation. You will need numeric source data and a set of bin limits. Keep a copy of your original chart until the replacement looks right.

What You’ll Need

  • A column of numeric observations, such as times, measurements, scores, or prices. Remove or review text entries and blanks before counting.
  • A worksheet area for a frequency table, including readable bin labels and the count for each bin.
  • Excel for Microsoft 365 on Windows. Excel for Mac has comparable chart types, although ribbon labels and dialog placement can vary. Excel for the web may offer fewer chart-formatting controls.

Step-by-Step

  1. Confirm what you mean by switching the axes. In a standard histogram, the measured values are grouped into bins along the horizontal axis, and the number of observations in each bin appears on the vertical axis. That is the usual histogram layout. If you want the counts horizontal and the bin categories vertical, you need a horizontal bar chart. If you only want different bin widths or boundaries, keep the histogram and adjust its bin settings instead.
  2. Check the existing chart before replacing it. Click the histogram and read the axis titles, if present. The bottom axis should represent bins and the side axis should represent frequency. Excel’s Chart Design > Switch Row/Column command changes how eligible chart data series are grouped; it does not turn the built-in Histogram chart on its side. It may be unavailable or have no useful effect for this chart type, so do not rely on it for an axis swap.
  3. Set up a frequency table next to your data. For this example, assume observations are in A2:A11. Enter upper bin limits 10, 20, 30, and 40 in D2:D5. In C2:C5, enter labels that describe the intervals, such as “≤10,” “(10, 20],” “(20, 30],” and “(30, 40].” These labels mean the first bin includes values up to and including 10, while each later bin excludes its lower boundary and includes its upper boundary. Adjust the limits and wording for your own measurement scale.
  4. Count the observations in the first bin. With the example data in A2:A11 and the first upper limit in D2, enter =COUNTIF($A$2:$A$11,"<="&D2) in E2. This counts values at or below 10. In the illustrative data 3, 7, 12, 18, 21, 24, 29, 31, 35, and 39, the result is 2.
  5. Count the remaining bins. With the same data in A2:A11, the previous upper limit in D2, and the next upper limit in D3, enter =COUNTIFS($A$2:$A$11,">"&D2,$A$2:$A$11,"<="&D3) in E3. For the example, this counts values greater than 10 and no more than 20, returning 2. Fill E3 down through E5. The results should be 2, 2, 3, and 3, for a total of 10 observations. Confirm that the last upper limit covers the largest value; otherwise, add another bin so no observations are left out.
  6. Make sure the table is chart-ready. Your category labels should be in C2:C5 and their matching counts in E2:E5. Keep the labels in the same row as their counts. You can add a heading above each column, but do not select the raw observations when creating this replacement chart. If the observations can be negative, choose a first bin limit that accounts for them; the example’s first-bin formula counts every value at or below 10.
  7. Insert a horizontal bar chart. Select C2:C5, then hold Ctrl and select E2:E5. On the ribbon, choose Insert > Insert Column or Bar Chart > 2-D Bar > Clustered Bar. Excel creates horizontal bars: the bin labels appear vertically, while frequency is plotted horizontally. If selecting two nonadjacent ranges is awkward, copy the labels and counts into adjacent columns first, then select that two-column table and insert the chart.
  8. Check the category order and axis titles. The first bin may appear at the bottom of a horizontal bar chart. If you want the lowest bin at the top, right-click the vertical category axis, choose Format Axis, and select Categories in reverse order. Depending on the version, the setting may be named Categories in reverse order under Axis Options. Add or edit titles through Chart Design > Add Chart Element > Axis Titles. Label the horizontal axis “Frequency” or “Count” and the vertical axis “Measurement range” or a more specific name.
  9. Make the bars resemble a histogram if appropriate. Right-click a bar and choose Format Data Series. Under Series Options, reduce Gap Width; set it to 0% if you want adjacent bars. This is a visual treatment, not a conversion into Excel’s statistical Histogram chart. Use equal-width, consecutive intervals if bars touch, and make sure labels clearly communicate any boundary rules or unequal widths.
  10. Review and preserve the result. Check that the counts add to the number of valid observations, the labels match the ranges, and the axes describe the intended quantities. Give the chart a clear title. If the original histogram was useful, keep it on the sheet or duplicate the worksheet before changing the layout. Save the workbook after confirming the chart updates when the frequency table changes.

Common Mistakes

Looking for a Switch Row/Column button that swaps the histogram axes. That command is not a general x/y flip. A Histogram chart has a specialized bin axis and a frequency axis, and its orientation is fixed. Build a frequency table and use a clustered bar chart when the categories need to run vertically.

Using a regular column chart without checking the orientation. A clustered column chart still puts categories along the bottom and values vertically. Choose 2-D Bar > Clustered Bar for horizontal bars. The bar-chart axes are not a literal coordinate rotation of the histogram, but they show the requested arrangement.

Leaving gaps between bars when the goal is a histogram-like appearance. Excel bar charts normally show space between categories. Adjust Gap Width in Format Data Series if touching bars suit the data. Do not force bars together if the bins are irregular or represent separate categories; the appearance could suggest a continuous distribution that the data does not support.

Creating ranges with missing or overlapping boundaries. For example, counting both 10 and 20 in adjacent bins can double-count a value, while excluding both can lose it. Decide whether each boundary belongs to the bin on its left or right, use consistent labels, and use matching count criteria. The example uses greater than the previous limit and less than or equal to the next limit.

Forgetting values outside the selected bins. If the final limit is 40 but some observations are 42, the example table will not count those values. Set the final limit high enough, or create an additional overflow bin and count it deliberately. Also check for text-formatted numbers, which may not be counted as numeric observations.

Tips

Use bin labels that explain intervals rather than displaying only their upper limits. Labels such as “(10, 20]” are precise but may be unfamiliar to an audience; “More than 10 to 20” is often easier to read. State in a note whether a boundary value belongs to the lower or upper interval. For whole-number data, labels such as “11–20” can work if those are genuinely the values represented.

Keep bin widths consistent when the chart is meant to communicate a distribution. If bin widths vary, a bar’s height still represents the count in that interval, not a normalized density. In that situation, a simple frequency bar chart can be misleading as a histogram; use equal-width bins or explain the different widths and consider whether frequency density is the better measure.

For a native histogram whose orientation is already correct, change binning instead of rebuilding. Select the horizontal axis, open Format Axis, and use the Bins options to set a bin width or number of bins. Depending on the data and Excel version, you may also see underflow and overflow bin settings. Those options change how values are grouped, not which axis is horizontal.

For larger datasets, keep the source values in one uninterrupted column and put the summary table elsewhere. Use clear headings and avoid including totals as an extra category in the chart selection. If you expect new observations, consider making the source range an Excel table so the data is easier to maintain, then confirm that your count formulas and chart range include new rows.

Troubleshooting

The chart still has bins along the bottom. Check that you inserted a 2-D Bar chart, not a Column chart or another Histogram chart. The selected chart type should be Clustered Bar. If you used Chart Design > Change Chart Type, choose Bar from the list and select Clustered Bar.

Excel shows the wrong labels or counts. Verify that each label is paired with its count and that the chart source includes only the label and count columns. In an adjacent summary table, select both columns with their headers and use Chart Design > Select Data to inspect the category labels and series values. Remove any blank rows or total rows included unintentionally.

The total of the bins is smaller than the number of observations. Check the lowest and highest values, the first and last limits, and whether the source cells contain numbers stored as text. The example formula for the first bin includes all values at or below its limit, so it may also count negative values. Add bins or revise the first-bin rule if your data range requires it. You can compare the sum of the counts with the number of valid numeric values in the source.

The bars run in the opposite order. Right-click the vertical category axis, open Format Axis, and toggle Categories in reverse order. Excel may move the horizontal axis to the top after reversing categories. If that happens and you prefer it at the bottom, inspect the horizontal axis formatting options for where the axis crosses the category axis.

The chart does not update when you edit the data. The chart uses the summary table, not necessarily the original observations directly. Confirm that the count formulas recalculate and that the chart’s selected data range includes all summary rows. If you added bins, extend both the formulas and the chart range. On Excel for the web, open the workbook in the desktop app if a needed axis or series-formatting control is unavailable.

The Histogram option is missing or behaves differently. Excel’s available chart features can depend on the platform and build. On Windows, look under Insert > Insert Statistic Chart > Histogram. On Mac, look for the statistical chart options on the Insert tab; names and placement can differ by release. If you cannot edit the native chart’s bin settings in your version, use the frequency-table method and a clustered bar chart.

Frequently Asked Questions

Can I swap the x- and y-axes directly in Excel’s Histogram chart?
No. Excel’s built-in Histogram chart fixes bins on the horizontal axis and frequency on the vertical axis. Use a horizontal bar chart based on a frequency table to put categories vertically and counts horizontally.

Does Chart Design > Switch Row/Column do the same thing?
No. It changes how data is arranged into series for chart types that support it; it does not rotate the specialized axes of a Histogram chart. It is not a substitute for rebuilding the display as a bar chart.

Will the horizontal bar chart be a true histogram?
It is a practical visual alternative that shows the same bin labels and counts, but it is a bar chart, not Excel’s built-in Histogram chart. Touching bars can make it look similar, but the chart does not automatically calculate bins or apply histogram-specific axis settings.

Can I change only the bin width?
Yes. Select the native histogram’s horizontal axis, open Format Axis, and change the bin width or number of bins under Bins. The available options can vary with the chart and Excel version. This changes the grouping without swapping axes.

Do the instructions work in Excel for Mac?
The frequency-table approach and clustered bar chart are also available in Excel for Mac. Ribbon wording or the location of Format Axis and Format Data Series controls may differ slightly by release. Excel for the web may have fewer formatting options, so use the desktop app if a control is missing.

What if I want the counts on the vertical axis and the bins on the horizontal axis?
That is already the standard histogram orientation. If your chart does not show that layout, confirm that you inserted a Histogram chart rather than a bar chart, and use Format Axis to adjust bin settings or axis labels as needed.

Related

Try it: the Percentage Formula Generator: percent of, percent change, increase and decrease, with the formula.

More in Charts & pivot tables

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.