Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel chart x axis showing sequential numbers, not actual value

I have 2 columns in my excel file. 1 is 'code' which has the following values: 2050, 2196, 1605, D1488. The next column is 'amount' which has dollar amount values. When I insert a column chart, the x axis shows 1, 2, 3, 4, 5, 6. The y axis is showing two bars which are the code and amount. I want the x axis to show the numbers in the 'codes' column. How do I do this? I realize that it's because they're numbers, that's why it's not working. But if I change this column to actual text like a, b, c, etc. then it will work. So any way to get around this?

like image 309
jerry Avatar asked Jun 10 '16 16:06

jerry


People also ask

Why does excel replace the x axis with a number?

If any of the data for the X axis is text that looks like a number (instead of being true numerical values), then Excel will substitute 1,2,3,... for the horizontal axis. To repair the chart, you could enter the numbers explicitly.

What does the x axis show when I insert a column?

When I insert a column chart, the x axis shows 1, 2, 3, 4, 5, 6. The y axis is showing two bars which are the code and amount.

How do I change the axis labels on a 2D chart?

In the Charts area, pick a 2D column chart Select the Design Ribbon. Pick Select Data. In the Select Data Source dialog, Remove the Code Series. In the Select Data Source dialog, Edit the Horizontal (Category) Axis Labels. In the Axis Labels dialog, for Axis Label Range, enter the data range for Code (exclude the header, the first row).

Why are there numbers instead of text on my chart?

Not sure what the source of the issue is, but it might be the "hide" feature. Edit the chart data and check the entries for "Horizontal (Category) Axis Labels". If you see numbers there instead of the desired text, click Edit and select the range where the text labels are.


3 Answers

Starting with this data ...

Code    Amount
2050     $680.00 
2196     $824.00 
1605     $127.00 
1488     $853.00 

Use the following steps ...

  1. Select the data range.
  2. Select the Insert Ribbon. In the Charts area, pick a 2D column chart

enter image description here

  1. Select the Design Ribbon. Pick Select Data.
  2. In the Select Data Source dialog, Remove the Code Series.

enter image description here

  1. In the Select Data Source dialog, Edit the Horizontal (Category) Axis Labels.

enter image description here

  1. In the Axis Labels dialog, for Axis Label Range, enter the data range for Code (exclude the header, the first row).

enter image description here

  1. In the Select Data Source dialog, click OK.

enter image description here

like image 62
OldUgly Avatar answered Oct 10 '22 20:10

OldUgly


Alternatively, click on the graph, then the Filter button which appears in the top right, below the + and the paintbrush icons.

Click on Names, and then under Categories click on Column A (or wherever your values are)

This should change the layout of the graph to pull the actual values, rather than their positions, and doesn't require any other changes to your graph range.

like image 36
Ben Pentelow Avatar answered Oct 10 '22 21:10

Ben Pentelow


Here is another solution for this or similar problem. I propose to use the Funfun Excel add-in to do this. This add-in allows you to use JavaScript code directly in Excel so you could use powerful libraries like Chart.js or D3.js to plot chart like this easily. Here I made an example based on your problem and sample data.

enter image description here

Based on your description, what you need to do is to make the data in the code column recognized as labels rather than real values. This is very easy to achieve in Chart.js since all you need to do is to set them as labels in the code.

The Funfun also has an online editor in which you could explore with your JavaScript code and test the result. You could check the detailed code of this example on the link below.

https://www.funfun.io/1/edit/5a4a4fda927dd84b42aceb91

Once you are satisfied with your result in the online editor, you could easily load the result into your Excel (so you could see the chart and data directly in Excel) using the URL below. But first, of course, you need to insert the Funfun add-in into your Excel from Insert-Office add-ins. Here are some screenshots showing you how to load the example into your Excel.

enter image description here

enter image description here

Disclosure: I'm a developer of Funfun

like image 2
Chuan Qin Avatar answered Oct 10 '22 19:10

Chuan Qin