find last cell address in Range

gtd526

Well-known Member
Joined
Jul 30, 2013
Messages
684
Office Version
  1. 2019
Platform
  1. Windows
Hello,
Looking to replace the last cell in ($S$10:$S$21) with a formula to find the last occupied cell address in S:S. ie ($S$10:some formula here))
Thank you

The Whole Enchilada.xlsm
RSTU
9Stock %'sRank
102x3x38.26%4fix this formula T10
11SPDR ETFs2.97%9ie $S$21
12Technology42.86%2
13Pot'l Invests38.97%3
14NRVUS0.00%11
15ETNA0.00%11
16Retirement13.12%7
17Chaikin23.39%5
18401k5.68%8
19AMTD0.74%10
20Roth IRA19.70%6
21Schwab57.58%1
22Last Occupied Cell (array)
23"S"&MATCH(2,1/(S:S<>""),1)
24S21
Main
Cell Formulas
RangeFormula
R10:R21R10=LOOKUP(2, 1/((COUNTIF($R$9:R9,$B:$B)=0)*($B:$B<>"")),$B:$B)
S10:S21S10=INDEX(C:C,MATCH(R10,B:B,0))
T10T10=SUMPRODUCT((S10<=$S$10:$S$21)/COUNTIF($S$10:$S$21,$S$10:$S$21))
T11:T21T11=SUMPRODUCT((S11<=$S$10:$S$21)/COUNTIF($S$10:$S$21,$S$10:$S$21))
R24R24="S"&MATCH(2,1/(S:S<>""),1)
Press CTRL+SHIFT+ENTER to enter array formulas.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi,
A couple of possibilities.
One is offset with count, if you don't have any numbers in column S except for the ones you want to include, replace $S$10:$S$22 with OFFSET(S10,0,0,COUNT(S:S))
Offset can define a range with the 4th and 5th arguements, 5th not used in this example

Another option is to turn your data into a table, the references within a table all for formulas that calculate based on the full data range of the table, so they are dynamic in nature. This would be my choice but I don't know the full extent of your requirements. it may not work for you.
 
Upvote 0
Solution
Hi,
A couple of possibilities.
One is offset with count, if you don't have any numbers in column S except for the ones you want to include, replace $S$10:$S$22 with OFFSET(S10,0,0,COUNT(S:S))
Offset can define a range with the 4th and 5th arguements, 5th not used in this example

Another option is to turn your data into a table, the references within a table all for formulas that calculate based on the full data range of the table, so they are dynamic in nature. This would be my choice but I don't know the full extent of your requirements. it may not work for you.
Thank you for the formula.
 
Upvote 0
One is offset with count, if you don't have any numbers in column S except for the ones you want to include
.. and also provided there are no blanks or text values in the range you want to use - see U10 below where an incorrect result is returned.

In any case I would consider avoiding the volatile function OFFSET especially if there are a lot of these sort of calculations in the worksheet - suggestion in V10
However, using whole column references in formulas like that carry a considerable calculation burden. If you can give some sort of row limit like i have in W10, the calculation burden is much less.

23 08 14.xlsm
STUVW
103102727
112
12
135
14xx
159
168
17
Test
Cell Formulas
RangeFormula
U10U10=SUM(OFFSET(S10,0,0,COUNT(S:S)))
V10V10=SUM(S10:INDEX(S:S,AGGREGATE(14,6,ROW(S:S)/(S:S<>""),1)))
W10W10=SUM(S10:INDEX(S:S,AGGREGATE(14,6,ROW(S10:S1000)/(S10:S1000<>""),1)))
 
Upvote 0

Forum statistics

Threads
1,223,891
Messages
6,175,229
Members
452,621
Latest member
Laura_PinksBTHFT

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