Take your pick:
If the data is numeric:
=LOOKUP(MAX(A1:Z1)+1,A1:Z1)
If the data is text:
=LOOKUP(REPT("z",255),A1:Z1)
If the data is mixed:
=LOOKUP(2,1/(A1:Z1<>""),A1:Z1)
Biff
"Carolyn Bennett" <Carolyn Ben...@discussions.microsoft.com> wrote in
message news:0E6D883C-9F9B-4B7C...@microsoft.com...
That was exactly what I wanted, thank you so much! I have no idea how it
worked, but it worked.
I don't suppose you would now know how to now that I have worked out what
the last entry in the in the row is, how I can tell it to reference the cell
two cells vertically above it?
It could be as easy as:
=OFFSET(B4,-2,MATCH(A1,B4:IV4,0)-1)
Where:
A1 = result of your lookup formula
Row 4 is the row that the lookup formula was used on
B4 is the first cell in row 4 that begins the data range
More detail would be helpful!
Biff
"Carolyn Bennett" <Carolyn...@discussions.microsoft.com> wrote in
message news:F5F67464-1C1C-4D06...@microsoft.com...
Why go through the range twice? Also, if there were any errors in the range,
the MAX call and thus the LOOKUP call would propagate the first error
encountered. Use .999999999999999E308 rather than the MAX call to be sure to
return the last numeric value if there are any.
>If the data is mixed:
>
>=LOOKUP(2,1/(A1:Z1<>""),A1:Z1)
Begging the question what to do if the last nonblank (strict sense) cell
evaluates to "". An alternative,
=LOOKUP(2,1/(1-ISBLANK(A1:Z1)),A1:Z1)
Actually, light testing shows that the following work.
=LOOKUP(TRUE,ISNUMBER(A1:Z1),A1:Z1)
=LOOKUP(TRUE,ISTEXT(A1:Z1),A1:Z1)
=LOOKUP(TRUE,NOT(ISBLANK(A1:Z1)),A1:Z1)
=LOOKUP(9.99999999999999E+307,3:3)
would yield that entry if row 3 is not empty.
If you replace LOOKUP with MATCH in the above formula, you will get the
position of the last numeric entry.
If you want the value from row 1 which is associated with the last
numeric entry in row 3...
=LOOKUP(9.99999999999999E+307,3:3,1:1)
Put up in terms of exact ranges, e.e.,:
=LOOKUP(9.99999999999999E+307,C3:Z3)
=MATCH(9.99999999999999E+307,C3:Z3)
=LOOKUP(9.99999999999999E+307,C3:Z3,C1:Z1)
Carolyn Bennett wrote:
[...]
> I don't suppose you would now know how to now that I have worked out what
> the last entry in the in the row is, how I can tell it to reference the cell
> two cells vertically above it?
[...]
Why go through the range twice? Also, if there were any errors in the range,
the MAX call and thus the LOOKUP call would propagate the first error
encountered. Use .999999999999999E308 rather than the MAX call to be sure to
return the last numeric value if there are any.
====================
It's just a personal preference. It's easier than trying to count the number
of 9s when typing .999999999999999E308 or 9.99999999999999E+307. There's no
doubt it's more efficient but I also believe that the vast majority of
spreadsheets are not so robust that efficiency is a primary concern. At the
most, that formula only goes through a full row. That is a good point about
the possibility of errors, though.
Biff
"Harlan Grove" <hrl...@aol.com> wrote in message
news:uc6y%2320GG...@tk2msftngp13.phx.gbl...
You have a spreadsheet that you keep for your bowling league. The bowlers
scores are recorded and one of the formulas you use is to lookup the last
score posted in row 2. Assume the cells for the scores have data validation
applied so that only TRUE bowling scores can be entered.
Which formula would you use (if either) and why?
=LOOKUP(9.99999999999999E+307,2:2)
=LOOKUP(301,2:2)
I would use the 2nd.
Biff
"Harlan Grove" <hrl...@aol.com> wrote in message
news:uc6y%2320GG...@tk2msftngp13.phx.gbl...