Function Problems

How to Find the Last Nonblank Value for an Employee in Excel

Steven ParkerSteven Parker Nov 11, 2026 868 views

Question details

The user needs to retrieve the most recent or last nonblank balance for an employee from a dataset grouped by ID and separated by headers or blank rows.

How to Find the Last Nonblank Value for an Employee in Excel
Product
Excel
Device & OS
not provided
Scenario
Tracking employee balances (like PTO) over time when records are formatted in grouped lists rather than a continuous flat table.
Observed behavior
The goal is to extract the latest nonblank record for each employee effectively, either by restructuring the dataset or using advanced lookup functions.
Before you start

Review your dataset structure. Consider whether you can restructure the data into a standard flat table (e.g., Employee ID, Date, Balance) before applying formulas, as this significantly simplifies calculations and prevents errors caused by blank rows.

Solution 1Recommended

Restructure Data and Summarize with a PivotTable

The most robust approach is to normalize your data into a single flat table rather than keeping separate formatted groups per employee.

Keeping track of employee balances in separate, visually formatted groups makes data analysis difficult. By consolidating everything into one large table with three columns (Employee ID, Hours, and Date), you can easily calculate current balances.

1
Create a unified table

Set up a single table with three headers: Employee ID, Date, and PTO Balance (or Hours).

2
Enter data consistently

Input the starting balance for each employee as a positive number. Below those, log the number of hours used by each employee over time as a negative number.

3
Insert a PivotTable

Select your entire data range, go to the Insert tab, and click PivotTable. Choose to place it on a new worksheet.

4
Summarize the balances

In the PivotTable Fields pane, drag 'Employee ID' to the Rows area, and 'PTO Balance' to the Values area. The PivotTable will automatically sum the positive and negative values to show the current balance for each employee.

Restructure Data and Summarize with a PivotTable
Best Practice: Whenever you need to reset an employee's balance or add their yearly entitlement, simply add a new row with a positive number of hours. The PivotTable will update automatically upon refreshing.
Manage Employee Data in WPS Spreadsheet

Track Employee Balances Easily with WPS Spreadsheet

WPS Spreadsheet provides powerful functions like XLOOKUP, FILTER, and PivotTables to seamlessly manage and retrieve employee data. It offers a familiar interface and is fully compatible with Microsoft Excel formats.

  1. 1. Open your data in WPS Spreadsheet: Launch WPS Office, open your .xlsx file, and view your employee dataset.
  2. 2. Standardize your layout: Organize your data into continuous columns without blank separating rows to ensure formula accuracy.
  3. 3. Apply formulas or PivotTables: Use the XLOOKUP function to search from the bottom up, or insert a PivotTable from the Insert tab to automatically summarize employee balances.
Free and lightweight spreadsheet softwareFull compatibility with Microsoft Excel (.xlsx) formatsBuilt-in support for advanced functions like XLOOKUPUser-friendly PivotTables for organizing employee records
microsoft office alternative - wps office

Frequently Asked Questions

Why is my XLOOKUP returning the first value instead of the last?

By default, XLOOKUP searches from the first row to the last row. To find the last nonblank value, you must set the `search_mode` argument (the 6th parameter in the formula) to `-1`, which instructs it to search from last to first.

Can I find the last nonblank value using VLOOKUP?

VLOOKUP does not have a built-in parameter to search from the bottom up. To achieve this with VLOOKUP, you would need to sort your data in descending order by date first. Alternatively, it's better to use XLOOKUP or an INDEX/MATCH array formula.

What does data normalization mean in Excel?

Normalizing data means structuring it into a continuous, flat table (e.g., columns for Employee ID, Date, and Amount) without blank rows, merged cells, or visual block separations. This standard format allows PivotTables and lookup functions to work reliably.