find 2nd last value (number) in row greater than 0

APML

Board Regular
Joined
Sep 10, 2021
Messages
216
Office Version
  1. 365
Hi all.. I'm a little stuck and would appreciate any help....
Lets say I have a range from A1 to J1 and I want to find the 2nd last number in the row that's greater than 0, i.e see below, I'm trying to extract 9
Note all these number have been generated from formula's in the cells.

1662603998293.png
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Try:

Book1
ABCDEFGHIJ
12357059300
2
39
Sheet11
Cell Formulas
RangeFormula
A3A3=INDEX(1:1,AGGREGATE(14,6,COLUMN(A1:J1)/(A1:J1<>0),2))


Or:

Excel Formula:
=LET(f,FILTER(A1:J1,A1:J1<>0),c,COLUMNS(f),INDEX(f,c-1))

if you like the newer functions.
 
Last edited:
Upvote 0
Try:

Book1
ABCDEFGHIJ
12357059300
2
39
Sheet11
Cell Formulas
RangeFormula
A3A3=INDEX(1:1,AGGREGATE(14,6,COLUMN(A1:J1)/(A1:J1<>0),2))


Or:

Excel Formula:
=LET(f,FILTER(A1:J1,A1:J1<>0),c,COLUMNS(f),INDEX(f,c-1))

if you like the newer functions.
Hey wow..haven't used anything like that before.
My actual range is E12 : JD12 (I put A1 : J1 in the example because I thought it would be simpler to explain).. I'll be copying to down a few hundred rows.
With that in mind how do I chage your formula =INDEX(1:1,AGGREGATE(14,6,COLUMN(A1:J1)/(A1:J1<>0),2)) to suit ?
 
Upvote 0
Hey wow..haven't used anything like that before.
My actual range is E12 : JD12 (I put A1 : J1 in the example because I thought it would be simpler to explain).. I'll be copying to down a few hundred rows.
With that in mind how do I chage your formula =INDEX(1:1,AGGREGATE(14,6,COLUMN(A1:J1)/(A1:J1<>0),2)) to suit ?
Hey fantastic. I worked it out. Thanks very much, you've saved me
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,525
Members
448,969
Latest member
mirek8991

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