View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Formula for Last Cell in a Row with a Value

You are right. See my latest response to the OP for a revised formula.

--
Rick (MVP - Excel)


"JMB" wrote in message
...
A possible issue could be if the last value in row 3 is duplicated earlier
in
that row. Match will return the location of the first instance.

Unless I am misunderstanding something, can it be simplified to:
=LOOKUP(2,1/(3:3<""),1:1)

Maybe change the <"" to 0 if that works better for the OP.

"Rick Rothstein (MVP - VB)" wrote:

The following formula will return the cell value in Row 1 (assumed header
row) for the last cell that has data in Row 3...

=INDEX($1:$1,1,MATCH(LOOKUP(2,1/(3:3<""),3:3),3:3,0))

Change the three occurrences of 3:3 to whatever row you want (for
example,
change them to 5:5 for Row 5). This formula can be copied down if
required.

Rick


"cardan" wrote in message
...
Hello all,

I am working on some cash flows and I am trying to find a formula that
will return the month with the last value in it.
For example; I have a header row with 24 "months" in it. (each cell
equals a sequential month, year) below that I have a set of cash
flows. These cash flows can either go out 2 months, 15 months, 24
months, etc..) I am trying to write a one-cell formula that will find
the last month with a value and then return the month (the header). I
have a formula that looks in the column above and looks at the sum of
the remaining months. It looks something like this.
=IF(AND(above cashflow0,SUM(above cashflow-over 1:end
cashflow)=0),date,"-")

This works, however, I have to have create another row to calculate
every cell. I would like to just have one cell to tell me the last
month. Is this possible?

Thank you for you time.

Cheers,

Dan