Search code examples
google-sheetsaxis

Google Sheets Line Chart: adjust horizontal axis limits to exclude missing cells


I noticed that the horizontal axis fits X values even if the corresponding Y-values are missing. Is there a way to automatically adjust horizontal axis limits to exclude missing cells?

https://docs.google.com/spreadsheets/d/1X3BhDyideX-7kyJ9Y-7xvV1naAwWd9eDPfPy3pP94Ic/edit?usp=sharing (sheet "Horizontal Axis Limits")

Thank you.


Solution

  • Use Data > Filter to hide blank rows. They will automatically be left out of the chart.

    Alternatively, create a new data table that omits the blanks, like this:

    =query(A1:B, "where B is not null", 1)

    Then set the chart's data range to the new table.