ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Lookups
  3. Find the First Non-Blank Cell in a Row or Column in Excel

Find the First Non-Blank Cell in a Row or Column in Excel

By ExcelReady Team·Updated November 2, 2026·7 min read

The short answer

To return the first non-blank cell in a range, look up TRUE in a test for "not empty": =XLOOKUP(TRUE,B2:B8<>"",B2:B8) in Microsoft 365 or Excel 2021. In older versions, use =INDEX(B2:B8,MATCH(TRUE,INDEX(B2:B8<>"",0),0)). Swap the last range to return a label, such as the week or month, instead of the value.

Key takeaways

  • B2:B8<>"" turns the range into TRUE (has something) and FALSE (empty). Looking up TRUE finds the first filled cell.
  • XLOOKUP(TRUE,B2:B8<>"",B2:B8) works in Microsoft 365 and Excel 2021; INDEX and MATCH work in every version.
  • Return a different range, such as headers, to get the label of the first filled cell.
  • Cells holding a space are not blank. Use TRIM(B2:B8)<>"" to skip them.
On this page+
  1. The example data
  2. How the "not blank" test works
  3. The quick way: XLOOKUP
  4. Older Excel: INDEX and MATCH
  5. First non-blank cell in a row
  6. First number, first text or first non-zero
  7. When a cell looks blank but isn't
  8. Why does the formula return #N/A or the wrong cell?
  9. Practise it

To find the first non-blank cell in a column or row in Excel, test every cell for "not empty" and look up the first TRUE. In Microsoft 365 that is one short formula, =XLOOKUP(TRUE,B2:B8<>"",B2:B8), and older versions use INDEX and MATCH in the same way. This guide is for anyone who needs the first reading, first sale or first contact date from a list with gaps.

The example data#

All the column examples use these weekly meter readings in A1:B8. Readings started in week 3, and week 5 was missed:

AB
1WeekReading
21
32
431,520
541,544
65
761,590
871,610

The goal is to return 1,520, the first reading, and 3, the week it was taken.

How the "not blank" test works#

The trick behind every formula in this guide is the comparison B2:B8<>"". The <> sign means "not equal to", and "" means empty text. So Excel checks each cell and returns a list of TRUE and FALSE values:

CellValueB2:B8<>""
B2(empty)FALSE
B3(empty)FALSE
B41,520TRUE
B51,544TRUE
B6(empty)FALSE
B71,590TRUE
B81,610TRUE

The first TRUE is in the third position. Any lookup function that searches this list for TRUE finds that position, and you can then return whatever you like from the same row. The lesson on IS functions and SWITCH covers other tests, such as ISNUMBER, that also produce TRUE and FALSE lists.

The quick way: XLOOKUP#

XLOOKUP can search the TRUE/FALSE list directly. Look up TRUE, in the test, and return the readings:

Excel formula
=XLOOKUP(TRUE,B2:B8<>"",B2:B8)

The result is 1,520. To get the week instead, change only the last range:

Excel formula
=XLOOKUP(TRUE,B2:B8<>"",A2:A8)

That returns 3. If you want the position within the range rather than a value, XMATCH does the same search: =XMATCH(TRUE,B2:B8<>"") also returns 3, because B4 is the third cell of B2:B8.

If every cell might be empty, add XLOOKUP's fourth argument so you get a message instead of #N/A:

Excel formula
=XLOOKUP(TRUE,B2:B8<>"",B2:B8,"No readings")

XLOOKUP and XMATCH need Microsoft 365, Excel 2021 or later, or Excel for the web. The XLOOKUP function guide and the full XLOOKUP tutorial explain the other arguments.

Older Excel: INDEX and MATCH#

In Excel 2019 and earlier, use MATCH to find the position of the first TRUE and INDEX to return the value at that position:

Excel formula
=INDEX(B2:B8,MATCH(TRUE,INDEX(B2:B8<>"",0),0))

Read it from the inside out:

  1. INDEX(B2:B8<>"",0) builds the TRUE/FALSE list. Wrapping the test in INDEX with 0 lets older Excel handle the list without pressing Ctrl+Shift+Enter.
  2. MATCH(TRUE, ..., 0) finds the first exact TRUE: position 3.
  3. INDEX(B2:B8, 3) returns the third cell: 1,520.

To return the week instead, change the first range to A2:A8. In Microsoft 365 the simpler =INDEX(B2:B8,MATCH(TRUE,B2:B8<>"",0)) works too, because it handles arrays natively. The guides to INDEX and MATCH, and the INDEX MATCH tutorial, explain how the pair works.

First non-blank cell in a row#

The same formulas work across a row: just use row ranges. This table shows monthly purchases, with gaps before each customer's first order:

ABCDE
1CustomerJanFebMarApr
2Alba300250
3Bruno12090
4Chidi410380

To find each customer's first order amount, put this in F2:

Excel formula
=XLOOKUP(TRUE,B2:E2<>"",B2:E2)

To find the month of their first order, return the header row instead:

Excel formula
=XLOOKUP(TRUE,B2:E2<>"",B$1:E$1)

Fill both down (Windows: Ctrl+D; Mac: ⌘D). Alba's first month is Mar with 300, Bruno's is Jan with 120, and Chidi's is Feb with 410. The $ in B$1:E$1 keeps the formula pointing at the header row as it moves down.

First number, first text or first non-zero#

Change the test to find a specific kind of value. Each of these looks up TRUE:

GoalTest to useExample formula
First cell with anythingB2:B8<>""=XLOOKUP(TRUE,B2:B8<>"",B2:B8)
First numberISNUMBER(B2:B8)=XLOOKUP(TRUE,ISNUMBER(B2:B8),B2:B8)
First textISTEXT(B2:B8)=XLOOKUP(TRUE,ISTEXT(B2:B8),B2:B8)
First value above zeroB2:B8>0=XLOOKUP(TRUE,B2:B8>0,B2:B8)

ISNUMBER is useful when a column mixes numbers with notes such as "n/a": it skips the notes and returns the first real number. The guide to Excel IS functions covers ISNUMBER, ISTEXT and ISBLANK in detail.

When a cell looks blank but isn't#

The <>"" test treats a cell as blank only if it is truly empty or holds a formula that returns "". Two cases need care:

  • A cell with a space is not blank. If someone cleared a cell by typing a space, the formula returns that space. Use TRIM(B2:B8)<>"" instead, which removes spaces before testing.
  • ISBLANK behaves differently. NOT(ISBLANK(B2:B8)) treats a formula that returns "" as filled, because the cell contains a formula. For "first visible value", <>"" is usually what you want.

The guide to checking if a cell is not blank explains these differences with more examples.

To get the last non-blank cell instead of the first, tell XLOOKUP to search from the bottom with a search mode of -1: =XLOOKUP(TRUE,B2:B8<>"",B2:B8,,0,-1) returns 1,610. The guide on looking up the last match covers that in full.

Why does the formula return #N/A or the wrong cell?#

Most problems come from one of four small slips:

  1. Every cell is empty. There is no TRUE to find, so you get #N/A. Add XLOOKUP's "if not found" argument, or wrap the INDEX MATCH version in IFNA.
  2. The ranges are different sizes. =XLOOKUP(TRUE,B2:B8<>"",A2:A9) returns #VALUE!. Make both ranges start and end on the same rows.
  3. MATCH has no 0 at the end. Without the 0, MATCH does an approximate match on a list that isn't sorted, and the answer can be wrong without any error.
  4. TRUE is in quotes. "TRUE" is text, not the value TRUE, so nothing matches. Type TRUE without quotes.

Practise it#

Try the exercise on this page: it returns the first meter reading with XLOOKUP. Then practise XLOOKUP in a live spreadsheet, where every formula you type is checked instantly. If you work in older versions of Excel, the INDEX and MATCH lesson builds the same skills step by step.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Meter readings only started in week 3. Click D2 and return the first reading in B2:B8 with =XLOOKUP(TRUE,B2:B8<>"",B2:B8).

fx
ABCDE
1
Week
Reading
2
1
First reading
3
2
4
3
1520
5
4
1544
6
5
7
6
1590
8
7
1610
9
10
11

Tip: Look up TRUE, in the test B2:B8<>"", and return B2:B8.

Practise this in a lesson

LessonXLOOKUPLook up in any direction with XLOOKUP and show a friendly message when nothing matches.LessonINDEX and MATCHCombine INDEX and MATCH to look up in any direction, including returning a column to the left of the one you search.LessonIS functions and SWITCHCheck what's really in a cell with ISBLANK, ISNUMBER and ISTEXT, and turn short codes into labels with SWITCH.Function guideXLOOKUPXLOOKUP explained with real examples: exact matches, looking left and custom not-found messages, plus a live exercise to try now.Function guideINDEXLearn the Excel INDEX function: return a value by row and column position, build two-way lookups with MATCH, and practice live.Function guideMATCHLearn how Excel's MATCH finds the position of a value, why the 0 matters, and how it powers INDEX/MATCH. Includes a live exercise.

Frequently asked questions

How do I find the first non-blank cell in a column in Excel?

+

Use =XLOOKUP(TRUE,B2:B8<>"",B2:B8). The test B2:B8<>"" is TRUE for every cell with something in it, and XLOOKUP returns the value next to the first TRUE. In older Excel, use INDEX with MATCH(TRUE,...).

How do I get the column header of the first non-blank cell in a row?

+

Look up TRUE in the row and return the header row: =XLOOKUP(TRUE,B2:E2<>"",B$1:E$1). The $ before the row number keeps the headers fixed when you fill the formula down.

How do I find the first non-blank cell without XLOOKUP?

+

Use =INDEX(B2:B8,MATCH(TRUE,INDEX(B2:B8<>"",0),0)). The inner INDEX lets MATCH handle the TRUE/FALSE list without Ctrl+Shift+Enter in Excel 2019 and earlier.

Why does my first non-blank formula return a cell that looks empty?

+

That cell probably contains a space or another invisible character, so Excel doesn't treat it as blank. Test with TRIM(B2:B8)<>"" instead, or clean the data first.

How do I find the last non-blank cell instead?

+

Add -1 as XLOOKUP's search mode so it searches from the bottom: =XLOOKUP(TRUE,B2:B8<>"",B2:B8,,0,-1).

Sources

  • XLOOKUP function - Microsoft Support
  • INDEX function - Microsoft Support
  • MATCH function - Microsoft Support

Written and checked by the ExcelReady Team. First published November 2, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. The example data
  2. How the "not blank" test works
  3. The quick way: XLOOKUP
  4. Older Excel: INDEX and MATCH
  5. First non-blank cell in a row
  6. First number, first text or first non-zero
  7. When a cell looks blank but isn't
  8. Why does the formula return #N/A or the wrong cell?
  9. Practise it

Keep reading

Logic· 6 min read

IF Not Blank in Excel: Formulas That Skip Empty Cells

To test if a cell is not blank in Excel, compare it with empty text: =IF(C2<>"","Shipped","Pending"). The <> means "not equal to" and "" means empty, so the formula returns Shipped when C2 has anything in it. You can also write =IF(NOT(ISBLANK(C2)),"Shipped","Pending"), but that version treats formulas that return "" as filled.

Logic· 6 min read

ISBLANK, ISNUMBER and ISTEXT in Excel

ISBLANK returns TRUE when a cell is completely empty, ISNUMBER returns TRUE when it holds a real number, and ISTEXT returns TRUE when it holds text. Each takes one cell, like =ISBLANK(C2). They are most useful inside IF, for example =IF(ISNUMBER(C2),"OK","Check"), to catch bad data before you calculate with it.

Lookups· 6 min read

INDEX MATCH in Excel: The Beginner's Guide

INDEX MATCH is a lookup built from two functions. MATCH finds the position of a value in one column, and INDEX returns the item at that position from another column: =INDEX(A2:A9,MATCH(G2,B2:B9,0)). It can look left, it keeps working when columns are inserted, and it runs in every version of Excel.

More on lookups

  • How to Fix #N/A Errors in VLOOKUP and XLOOKUP
  • Fuzzy Match in Excel: Find Names That Nearly Match
  • HLOOKUP in Excel (and When to Use It)
  • INDEX Function in Excel: Return a Value by Position
  • INDEX MATCH MATCH: Two-Way Lookups Explained
  • INDIRECT Function in Excel: Build References From Text
All lookups articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free