如何在Excel中导入数据并制作基于X轴的多折线图(含6列不同行数数据处理方案)
Hey there! Let's break down your Excel questions step by step—this is totally doable, no need to stress.
1. Import Data and Create an X-axis-Based Multi-Line Chart
Common Ways to Import Data
- From Text/CSV: Go to the
Datatab →From Text/CSV, select your file, then follow the wizard to set delimiters (commas, tabs, etc.) and finish importing. - From Another Excel File:
Data→From File→From Workbook, pick the target file and choose the worksheet/range you want to import. - From External Data Sources (e.g., databases):
Data→From Other Sources, select the corresponding option and configure the connection settings.
Steps to Make the Multi-Line Chart
- Organize Your Data: Make sure your X-axis values (like dates, categories) are in one column, with your multiple series data in adjacent columns (even if row counts differ—we’ll fix that later).
- Insert the Line Chart: Select the range containing your X-axis and at least one series → Go to the
Inserttab → Choose aLine Chart(I recommendLine Chart with Data Markersfor clarity). - Add More Series: If you only selected one series initially, right-click the chart →
Select Data→ ClickAddunderLegend Entries (Series). For each series, specify theSeries Name(use the column header) andSeries Values(the data range for that column). Ensure all series use the sameHorizontal (Category) Axis Labels(your X-axis data range). - Tweak X-axis Settings: Right-click the X-axis →
Format Axisto adjust scale ranges, label positions, date/category formatting, etc. This ensures all lines align to the same X-axis.
2. Handle 6 Columns with Different Row Counts for a Multi-Line Chart
You don’t need any extra toolkits—Excel’s built-in features are all you need. The key is linking every series to a unified X-axis, even with mismatched row counts:
- Step 1: Create a Unified X-axis Base: First, compile all possible X-axis values (e.g., all dates or categories across all 6 columns) into a single column. Make sure this column covers every X value present in any of your series.
- Step 2: Align Series Data: Place each of your 6 data columns to the right of this unified X-axis column. Fill in data cells where they match an X-axis value, and leave cells blank where there’s no corresponding data (Excel automatically skips blank values, so your lines won’t break unnecessarily).
- Step 3: Generate the Chart: Select the unified X-axis column plus all 6 data columns → Insert your line chart. Excel will automatically recognize each series and plot them against the same X-axis.
- Alternative: Manually Add Series: If you don’t want to reorganize your data, right-click a blank chart →
Select Data, then add each of the 6 series one by one:- Click
Add, then pick the column header forSeries Name. - Select the full data range for that column as
Series Values. - For all series, set
Horizontal Axis Labelsto your unified X-axis range (the base column you created earlier).
- Click
This will give you a multi-line chart matching your desired example, with each series plotted correctly against the shared X-axis.
内容的提问来源于stack exchange,提问作者amirandi




