You are here:

- Home
- Computing/Technology
- Business Software
- Excel
- Finding the last >0 entry in a row

Advertisement

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):

=IF(COUNTIFS(C$3:C$30,$C3)=1,C$3,randomnumbers(1,$A$1))

D3 = 14

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

=IF($C3=D3,"",IF(COUNTIFS(D$3:D$30,$C3)=1,D$3,randomnumbers(1,$A$1)))

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

Pete

Pete,

Try this formula in AZ3

=LOOKUP(10000,C3:AY3)

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

=LOOKUP(10000,IF(ISNUMBER(C3:AY3)*(C3:AY3>0),C3:AY3,""))

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

--

Regards,

Tom Ogilvy

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

Excel

Answers by Expert:

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. **Education/Credentials**

Master of Science (MS) degree Operations Research (ORSA)**Awards and Honors**

Microsoft MVP in Excel.