Pull the Last Row from Multiple Sheets into One in Google Sheets

Want to pull just the last row from multiple sheets into one table in Google Sheets? Whether you’re consolidating monthly totals or summary rows into a dashboard, this guide will show you exactly how to do it, with formulas only, no Apps Script needed.

We’ll use a combination of FILTER, CHOOSEROWS, and QUERY functions to extract and consolidate the last row from each sheet.

Why Consolidate the Last Row from Multiple Sheets?

This method is helpful when:

  • Each sheet represents a month, and the last row contains monthly totals.
  • You want to create a dashboard that summarizes these totals in one place.
  • You don’t want to hardcode row numbers because rows may shift due to edits.

Hardcoding the last row number (e.g., Sheet1!A20:D20) can break easily. A formula-based approach is more robust.

Sample Data

Assume you have data in Sheet1 and Sheet2, each with four columns. The last row contains totals in columns 2 and 4.

Extract last row from multiple sheets in Google Sheets – sample data

Our goal: Extract only the last row from each sheet and consolidate them.

Step 1: Extract the Last Row from Each Sheet

To get the last row from Sheet1, use:

=CHOOSEROWS(FILTER(Sheet1!A:D, Sheet1!A:A<>""), -1)
  • FILTER(Sheet1!A:D, Sheet1!A:A<>"") filters out any blank rows.
  • CHOOSEROWS(..., -1) returns the last row of the filtered data.

To do the same for Sheet2:

=CHOOSEROWS(FILTER(Sheet2!A:D, Sheet2!A:A<>""), -1)

Step 2: Stack the Last Rows Together

Now use VSTACK to combine the last rows vertically:

=VSTACK(
  CHOOSEROWS(FILTER(Sheet1!A:D, Sheet1!A:A<>""), -1),
  CHOOSEROWS(FILTER(Sheet2!A:D, Sheet2!A:A<>""), -1)
)

This returns a new table with only the last row from each sheet stacked one below the other:

ABCD
Total75350
Total140765

Step 3: Summarize the Consolidated Last Rows

Finally, use QUERY to summarize the stacked data:

=QUERY(
  VSTACK(
    CHOOSEROWS(FILTER(Sheet1!A:D, Sheet1!A:A<>""), -1),
    CHOOSEROWS(FILTER(Sheet2!A:D, Sheet2!A:A<>""), -1)
  ),
  "SELECT Col1, SUM(Col2), SUM(Col4) GROUP BY Col1 LABEL SUM(Col2) '', SUM(Col4) ''"
)

This groups by Col1 (Item) and sums columns 2 and 4.

ABC
Total2151115

You can change the group or sum columns by editing the SELECT, GROUP BY, and LABEL parts.

Example:

To group by column 3 and sum column 2:

SELECT Col3, SUM(Col2) GROUP BY Col3 LABEL SUM(Col2) ''

Tip: The LABEL clause is used to rename or hide column headers in the output. If you change the columns in SELECT, you’ll likely want to update the corresponding LABEL entries as well to reflect new headers or leave them blank.

More Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Expert Prashanth KV is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Calculate Trip Days by Month (Start, End, and Full Days) in Google Sheets

If you're managing business travel in Google Sheets, you may need to calculate how...

Mode of Comma-Separated Numbers in Excel (Dynamic Array)

There is no dedicated function in Excel to directly find the mode of comma-separated...

How to Find Mode of Comma-Separated Numbers in Google Sheets

Working with comma-separated numbers inside a single cell is a common scenario in Google...

How to Count Merged Cells in Google Sheets (and Get Their Size)

Sometimes, you may have blocks of merged cells in a column or row. But...

More like this

Calculate Trip Days by Month (Start, End, and Full Days) in Google Sheets

If you're managing business travel in Google Sheets, you may need to calculate how...

How to Find Mode of Comma-Separated Numbers in Google Sheets

Working with comma-separated numbers inside a single cell is a common scenario in Google...

How to Count Merged Cells in Google Sheets (and Get Their Size)

Sometimes, you may have blocks of merged cells in a column or row. But...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.