Power Query Problems

Normalize a Doctor Shift Schedule in Excel with Power Query

Anum MushtaqAnum Mushtaq Nov 12, 2026 869 views

Question details

Convert a doctor-shift calendar into a normalized array or table where each row represents one doctor and date, with the date in column A, doctor name in column B, and shift details in subsequent columns.

Normalize a Doctor Shift Schedule in Excel with Power Query
Product
Microsoft Excel Power Query
Device & OS
not provided
Scenario
A calendar-style schedule must be reshaped into a row-based data table for filtering, reporting, or further analysis.
Observed behavior
The source data is arranged as a schedule grid rather than a normalized list, so dates, doctor names, and shift fields need to be separated into consistent columns.
Before you start

Identify which rows contain doctor names and which columns contain dates, shift types, or locations. Convert the source range to an Excel table first so Power Query can detect headers and expand the schedule consistently.

Solution 1Recommended

Unpivot the shift calendar with Excel Power Query

Use this method when the schedule is a repeating grid and you need a refreshable normalized table after each schedule update.

Power Query can convert multiple date or shift columns into rows. The exact unpivot columns depend on whether doctors are listed in rows or columns, so confirm the source headers and the fields required in the final output before applying the transformation.

1
Convert the source range to a table

Select the complete schedule range in Excel, including its headers, then choose Insert > Table. Confirm that My table has headers is selected, and give the table clear header names where possible.

2
Load the table into Power Query

Click any cell in the new table, then select Data > From Table/Range to open the Power Query Editor.

3
Keep the identifying fields

In Power Query, select the columns that should remain fixed in the result, such as Doctor, Department, or Shift Type. Use Home > Use First Row as Headers if the correct headers were imported as data.

4
Unpivot the schedule columns

Select the date or schedule columns that should become rows, then choose Transform > Unpivot Columns. Power Query creates Attribute and Value columns; rename Attribute to Date or Shift Field and rename Value to the appropriate shift-detail name.

5
Set data types and load the result

Select the Date column and choose Transform > Data Type > Date. Set doctor and shift-detail columns to Text as needed, then select Home > Close & Load to return the normalized table to Excel.

Unpivot the shift calendar with Excel Power Query
Choose the right columns to unpivot: If dates are across the top of the calendar, unpivot the date columns. If shift categories are across the top, keep Date and Doctor as identifier columns and unpivot the shift-category columns instead.
WPS Spreadsheet solution

Organize Doctor Shift Data into a Usable Table with WPS Spreadsheet

WPS Spreadsheet provides a lightweight workspace for arranging a doctor-shift calendar into a row-based table. Create Date, Doctor, and Shift columns, use formulas to reference or repeat schedule values, and then sort or filter the completed schedule for staffing review.

  1. 1. Open the schedule workbook: Open the Excel schedule in WPS Spreadsheet and select the worksheet that contains the calendar-style shift grid.
  2. 2. Add normalized output headers: Create a new worksheet, then enter Date, Doctor, Shift Type, and Shift Details as column headers in row 1.
  3. 3. Reference schedule values into rows: In the output sheet, enter formulas that reference the date header, doctor-name cell, and corresponding shift cell from the calendar. Fill the formulas down for each doctor-date combination.
  4. 4. Remove unused entries: Select the output table and use Data > Filter to hide blank Shift Details cells, leaving only scheduled shifts in the list.
  5. 5. Sort and save the result: Use Data > Sort to order the table by Date and Doctor, then choose Menu > Save As to save the normalized schedule as an .xlsx file.
Build a normalized Date, Doctor, and Shift table for schedule filtering and reporting.Use spreadsheet formulas, sorting, and filters to review doctor coverage.Open and edit Microsoft Excel .xlsx and .xls shift schedules with format compatibility.Use a familiar spreadsheet interface for an easy transition from Excel.
microsoft office alternative - wps office

Frequently Asked Questions

What does a normalized doctor shift schedule look like?

A normalized schedule uses one row per scheduled doctor and date. Typical columns are Date, Doctor, Shift Type, Start Time, End Time, Location, and Notes.

Which columns should I unpivot in Power Query?

Unpivot the repeating schedule columns, usually the columns headed by dates or shift categories. Keep identifying columns such as Doctor, Department, and any fixed schedule attributes unchanged.

Why does Power Query create Attribute and Value columns after unpivoting?

Attribute stores the original column header, such as a date or shift category, and Value stores the cell content from that column. Rename these columns to reflect their actual meaning in the final table.

Can Power Query update the normalized schedule when the calendar changes?

Yes. Keep the source data in an Excel table, update the calendar values, and then choose Data > Refresh All to rerun the Power Query transformation.

Can I use formulas instead of Power Query for a shift schedule?

Yes, if you use Microsoft 365 dynamic arrays. TOCOL can flatten shift values, while HSTACK, FILTER, INDEX, and SEQUENCE can assemble matching Date and Doctor columns; the formula depends on the source layout.