You are here:

Excel/Finding the last >0 entry in a row


Hi Tom,

Scoured everywhere, but all I get for my results in AZ3 are zero!

I have a set of values working from C3 across to AZ3 - come back to that later...

C3 is a random generated number (as are C4 thru C51):
=randomnumbers(1,$A$1) - $A$1 being the number of teams in the competition

C3 = 14

D3 is also a random generated number, but if it is found more than once in C3:C51, the random number generator runs again (once):

D3 = 14

All good so far, but now in E3, I have this formula:

All this means is that E3 returns "".  That's great cos copying the formula across to AY3 also returns "" in each cell.

What I want to do is lookup the last value, looking from left to right, in C3:AY3 and return it to AZ3.  In this example the answer should be the contents of D3, ergo 14

Can you help with the correct syntax for Cell AZ3 please mate?

many thanks in anticipation



Try this formula in AZ3


just make the 10000 any number bigger than a value that will appear in C3:AY3.  If the numbers will be less than 10000, then just leave it as 10000.  This should return the value of the last cell in C3:AY3 that has a number.  

This would return 0 if it was the value of the last cell with a number.  If you really want to exclude zero cells, then you could use this formula


this should be entered with Ctrl+shift+enter since it is an array formula.

Tom Ogilvy  
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Tom Ogilvy


Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]


Extensive experience.

Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.

©2017 All rights reserved.