Inconsistant Formula result...

jim may

Well-known Member
Joined
Jul 4, 2004
Messages
7,486
My formula L5 does not PRODUCE the Expected Result -- Of 5;
I'm sure there is a reason, but I don't at the moment know why it is.
Any help appreciated

Jim
Excel Workbook
ABCDEFGHIJKL
1Last Value InLast Value In
2abcdefCOLUMNSROWS
315.007.003.0015.004.009.009.004.00
423.002.002.003.00
537.008.008.0022.00<< Why not 5?
642.003.0022.0088.0088.0088.00
754.004.0011.00
865.0011.0011.009.00
Sheet1
Excel 2007
Cell Formulas
RangeFormula
I3=LOOKUP(2,1/(A3:G3<>""),A3:G3)
I4=LOOKUP(2,1/(A4:G4<>""),A4:G4)
I5=LOOKUP(2,1/(A5:G5<>""),A5:G5)
I6=LOOKUP(2,1/(A6:G6<>""),A6:G6)
I7=LOOKUP(2,1/(A7:G7<>""),A7:G7)
I8=LOOKUP(2,1/(A8:G8<>""),A8:G8)
K3=LOOKUP(1,1/(B$3:B$8<>""),B$3:B$8)
K4=LOOKUP(1,1/(C$3:C$8<>""),C$3:C$8)
K5=LOOKUP(1,1/(D$3:D$8<>""),D$3:D$8)
K6=LOOKUP(1,1/(E$3:E$8<>""),E$3:E$8)
K7=LOOKUP(1,1/(F$3:F$8<>""),F$3:F$8)
K8=LOOKUP(1,1/(G$3:G$8<>""),G$3:G$8)
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
I think you need a 2 as the lookup value, not a 1:
=LOOKUP(1,1/(D$3:D$8<>""),D$3:D$8)

Amend to:
=LOOKUP(2,1/(D$3:D$8<>""),D$3:D$8)

The result you have with your original formula, using a 1 for the first argument, is a bit hard for me to understand -- why not return a 3, in fact. But LOOKUP ranges must be sorted and your lookup vector is not sorted. "If the values in the Lookup_range are not sorted in ascending order, the Lookup function will return the incorrect value."

I found a treasure trove of such formula here:
http://excel.tips.net/Pages/T003785_Last_NonZero_Value_in_a_Row.html
And a page using on the technique you are employing:
http://www.dailydoseofexcel.com/archives/2004/12/02/getting-the-last-value/
 
Upvote 0
Hi,

For rows try =HLOOKUP(999999,A3:G3,1,1)

For columns try =LOOKUP(999999,G3:G8)

Where 999999 just input a large number you are never likely to see
 
Upvote 0
My formula L5 does not PRODUCE the Expected Result -- Of 5;
I'm sure there is a reason, but I don't at the moment know why it is.
Any help appreciated

Jim

Excel Workbook
ABCDEFGHIJKL
1Last Value InLast Value In
2abcdefCOLUMNSROWS
315.007.003.0015.004.009.009.004.00
423.002.002.003.00
537.008.008.0022.00<< Why not 5?
642.003.0022.0088.0088.0088.00
754.004.0011.00
865.0011.0011.009.00
Sheet1
Excel 2007
Cell Formulas
RangeFormula
I3=LOOKUP(2,1/(A3:G3<>""),A3:G3)
I4=LOOKUP(2,1/(A4:G4<>""),A4:G4)
I5=LOOKUP(2,1/(A5:G5<>""),A5:G5)
I6=LOOKUP(2,1/(A6:G6<>""),A6:G6)
I7=LOOKUP(2,1/(A7:G7<>""),A7:G7)
I8=LOOKUP(2,1/(A8:G8<>""),A8:G8)
K3=LOOKUP(1,1/(B$3:B$8<>""),B$3:B$8)
K4=LOOKUP(1,1/(C$3:C$8<>""),C$3:C$8)
K5=LOOKUP(1,1/(D$3:D$8<>""),D$3:D$8)
K6=LOOKUP(1,1/(E$3:E$8<>""),E$3:E$8)
K7=LOOKUP(1,1/(F$3:F$8<>""),F$3:F$8)
K8=LOOKUP(1,1/(G$3:G$8<>""),G$3:G$8)

Rowwise, just enter and copy down...

=LOOKUP(9.99999999999999E+307,B3:G3)

Columnwise, just enter and copy down:

=LOOKUP(9.99999999999999E+307,B3:B8)

You are interested in the last numeric value. The foregoing is the fastest
formula which delivers the goods.

=LOOKUP(N,/(B$3:B$8<>""),B$3:B$8)

is expensive and only needed in particular situations like having the need
to fetch any last value.

Grove, who first used such a formula, has set N to 2. The formula is of
course a variation on LOOKUP(9.99999999999999E+307,Ref). In fact, there is no need to invent particular constants for N. Just 9.99999999999999E+307
(or 9.99E+307) suffice. This number is mentioned in Excel's Help and provides the anchoring.
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,259
Members
452,901
Latest member
LisaGo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top