Formula to find the second to last value in row - Excel

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Formula to find the second to last value in row - Excel



I have the formula to find the last value in a row - =LOOKUP(1,1/(3:3>0),3:3) (depending on the row)



but can't seem to get it to return the second to last value/cell in the row.



Please help!




3 Answers
3



Try,


=INDEX(3:3, AGGREGATE(14, 6, COLUMN(A:XFC)/(A3:XFC3>0), 2))





Thank you! That did return a value. But my columns right now range from A:BM, and will be continuing to insert more columns... so I will need the formula to automatically update the range. Could you also explain the 14 and 6?
– Amy Collins
Aug 10 at 13:35






That's now coming up as =INDEX(3:3, AGGREGATE(14, 6, COLUMN($1:$1048576)/(3:3>0), 2)) returning a 0 :(
– Amy Collins
Aug 10 at 14:06




Awesome.. I edited the formula to:


=INDEX(3:3, AGGREGATE(14, 6, COLUMN(A3:XFC3)/(A3:BL3>0), 2))



Where BL3 is where my current last data value ends. Once I drag, the formula automatically updated the column and row value.



Thanks so much!



For row #3, the array formula:


=INDEX(3:3,IF(COUNTA(3:3)=0,"",MAX((3:3<>"")*(COLUMN(3:3))))-1)



will yield the next-to-last value in that row:



enter image description here



Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key. If this is done correctly, the formula will appear with curly braces around it in the Formula Bar.



If you are sure that row #3 will not be empty, then use this array formula instead:


=INDEX(3:3,MAX((3:3<>"")*(COLUMN(3:3)))-1)



To avoid array formulas consider:


=INDEX(3:3,SUMPRODUCT(MAX((COLUMN(3:3))*(3:3<>"")))-1)





Both formulas - I did enter correctly - returned a 0
– Amy Collins
Aug 10 at 14:38





@AmyCollins Then use Jeeped's approach.
– Gary's Student
Aug 10 at 14:40






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS