Return value furthest to the right in a row

eirikdaude

Board Regular
Joined
Nov 26, 2013
Messages
93
Office Version
  1. 365
Platform
  1. Windows
Putting the formula
Excel Formula:
=IFERROR(INDEX(Karbon[@[Januar]:[Desember]];1;COUNTA(Karbon[@[Januar]:[Desember]]));1)
results in a spill-error in the table below, when there are no entries in the columns I'm looking at, I assume because index returns all the columns when it gets 0 as the argument for the number of columns or something like that?
Is there some better way to get the entry furthest to the right in the a given range / row?

1675079851449.png
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
How about
Excel Formula:
=TAKE(FILTER(Karbon[@[Januar]:[Desember]];Karbon[@[Januar]:[Desember]]<>0);;-1)
 
Upvote 0
Forgot the error handling
Excel Formula:
=TAKE(FILTER(Karbon[@[Januar]:[Desember]];Karbon[@[Januar]:[Desember]]<>0,"");;-1)
 
Upvote 0
Forgot the error handling
Excel Formula:
=TAKE(FILTER(Karbon[@[Januar]:[Desember]];Karbon[@[Januar]:[Desember]]<>0,"");;-1)
Yeah, I think this would have worked perfectly from what I am reading, but unfortunately my workplace updates Office a bit too rarely for it to be a solution yet. We're still on V2108, while TAKE is only included in V2208 and later.

I think I should be able to come up with a solution based on the filter-function you show anyway, so thanks for the help!
 
Upvote 0
Ok, how about
Excel Formula:
=let(f;FILTER(Karbon[@[Januar]:[Desember]];Karbon[@[Januar]:[Desember]]<>0,"");index(f;;columns(f)))
 
Upvote 0
Solution
Works like a charm, and thanks for showing me how to store the result array in a variable - I would have used the filter function twice for sure!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,172
Messages
6,123,428
Members
449,099
Latest member
COOT

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