Skip to content
Free Excel Tutorials
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Data Analysis

  • Randomize/ Shuffle List in Excel
  • How To Filter Data in Excel
  • How to Use Solver Tool in Excel
  • How to sum a total in multiple Excel tables
  • Remove Duplicates Example in Excel

References

  • Get nth match with INDEX / MATCH in Excel
  • Last row number in range
  • How to reference named range different sheet in Excel
  • To count total rows in a range in Excel
  • How to get relative row numbers in a range in Excel

Data Validations

  • Excel Data validation date in next 30 days
  • How To Create Drop-down List in Excel
  • Excel Data validation must not contain
  • Excel Data validation exists in list
  • Prevent invalid data entering in specific cells

How to get last row in mixed data with blanks in Excel

by

To get the last relative position (i.e. last row, last column) for mixed data that may contain empty cells, you can use the MATCH function as described below.

Note: this is an array formula and must be entered with Control+Shift+Enter.

Formula

{=MATCH(2,1/(range<>""))}

Explanation

In the example shown, the formula in E5 is:

{=MATCH(2,1/(B4:B10<>""))}

Last *relative* position, not row on worksheet

When constructing more advanced formulas, it’s often necessary to figure out the last location of data in a list. Depending on the data, this could be the last row with data, the last column with data, or the intersection of both. We want the last *relative position* inside a given range not the row number on the worksheet:

How this formula works

This formula uses the MATCH function configured to find the position of the last non-empty cell in a range.

Working from the inside out, the lookup array inside MATCH is constructed like this:

=1/(B4:B10<>""))
=1/{TRUE;FALSE;TRUE;FALSE;TRUE;TRUE;FALSE}
={1;#DIV/0!;1;#DIV/0!;1;1;#DIV/0!}

Note: all values in the array are either 1 or the #DIV/0! error.

MATCH is then set to match the value 2 in “approximate match mode”, by omitting the 3rd argument is omitted.

Because the lookup value of 2 will never be found, MATCH will always find the last 1 in the lookup array, which corresponds to the last non-empty cell.

This approach will work with any kind of data, including numbers, text, dates, etc. It also works with null text strings that are returned by formulas like this:

=IF(A1<100,"")

Post navigation

Previous Post:

How to calculate project complete percentage in Excel

Next Post:

Popularly Used Excel Functions and their examples

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others

Logical Functions

  • Check multiple cells are equal in Excel
  • How to use Excel XOR Function
  • Nested IF function example in Excel
  • How to use Excel OR Function
  • IF, AND, OR and NOT Functions Examples in Excel

Date Time

  • Calculate expiration date in Excel
  • Assign points based on late time in Excel
  • Steps to create Dynamic calendar grid in Excel
  • WEEKDAY function: Description, Usage, Syntax, Examples and Explanation
  • WEEKNUM function: Description, Usage, Syntax, Examples and Explanation

Grouping

  • How to randomly assign data to groups in Excel
  • Group times into unequal buckets in Excel
  • Map inputs to arbitrary values in Excel
  • If cell contains one of many things in Excel
  • Categorize text with keywords in Excel

General

  • Count cells that do not contain errors in Excel
  • 44 Practical Excel IF function Examples
  • How to calculate percent of goal in Excel
  • Index and match on multiple columns in Excel
  • Select, Insert, Rename, Move, Delete Worksheets in Excel
© 2025 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning