Complete a Range of cells using a formula to find address of last occupied cell

gtd526

Well-known Member
Joined
Jul 30, 2013
Messages
696
Office Version
  1. 2019
Platform
  1. Windows
Hello,
Looking to find the Last Occupied Cell to complete the Range of Cells in a formula.
Using 'Test' L:L. Replace the $J$27 with a formula to find the address of the last non-blank cell. ie $N$20, to complete the formula in L:L.
Thank you.


Wager History.xlsm
JKLMN
19G/L $RankTESTLast Non-Blankaddress of
20-$5.45554.55J27
21-$15.0066
22-$0.4533
23$4.5522
24$9.1011
25-$5.0044
26-$5.0044
27$4.5522
28   
29   
30   
31   
32   
33   
34   
35   
36   
37   
NBA Betting Ranks
Cell Formulas
RangeFormula
J20:J37J20=IF(K20<>"",(F20*4.55)-(G20*5),"")
K20:K37K20=IF(J20<>"",SUMPRODUCT((J20<=$J$20:$J$27)/COUNTIF($J$20:$J$27,$J$20:$J$27)),"")
L20:L37L20=IF(E20<>"",SUMPRODUCT((J20<=$J$20:$J$27)/COUNTIF($J$20:$J$27,$J$20:$J$27)),"")
M20M20=LOOKUP(2,1/(J20:J51<>""),J20:J51)
N20N20="J"&MATCH(2,1/(J:J<>""),1)
Press CTRL+SHIFT+ENTER to enter array formulas.
 
One more thing to test, in an empty cell, what does this formula return?
=COUNT(J20:J1000)
It returns 14.
Thanks. But that was only one of the things that I asked.

What happens if you re-format columns F & G to show say 5 decimal places? Does it then show any different values in those columns compared to what we can see in your mini sheet above?

... what happens if you change the column J formula to this?
=IF(E20<>"",ROUND((F20*4.55)-(G20*5),2),"")
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Thanks. But that was only one of the things that I asked.
I've added the decimal places and changed the formula in J:J as you indicated.
Nothing has changed.

Cell Formulas
RangeFormula
D20:D51D20=IFERROR($F20+$G20,"")
E20:E51E20=IFERROR(LOOKUP(2, 1/((COUNTIF(E$19:$E19,'[My Wagers.xlsm]NBA'!$H$324:$H$501)=0)*('[My Wagers.xlsm]NBA'!$H$324:$H$501<>"")),'[My Wagers.xlsm]NBA'!$H$324:$H$501),"")
F20:F51F20=IFERROR(COUNTIFS('[My Wagers.xlsm]NBA'!$A$324:$A$501,"W",'[My Wagers.xlsm]NBA'!$H$324:$H$501,"<>",'[My Wagers.xlsm]NBA'!$H$324:$H$501,$E20)+$H20*0.5,"")
G20:G51G20=IFERROR(COUNTIFS('[My Wagers.xlsm]NBA'!$A$324:$A$501,"L",'[My Wagers.xlsm]NBA'!$H$324:$H$501,"<>",'[My Wagers.xlsm]NBA'!$H$324:$H$501,$E20)+$H20*0.5,"")
H20:H51H20=IF(E20<>"",COUNTIFS('[My Wagers.xlsm]NBA'!$A$324:$A$501,"Psh",'[My Wagers.xlsm]NBA'!$H$324:$H$501,"<>",'[My Wagers.xlsm]NBA'!$H$324:$H$501,$E20),"")
I20:I51I20=IFERROR($F20/($F20+$G20),"")
J20:J33J20=IF(E20<>"",ROUND((F20*4.55)-(G20*5),2),"")
K20:K51K20=IF(J20<>"",SUMPRODUCT((J20<=$J$20:$J$35)/COUNTIF($J$20:$J$35,$J$20:$J$35)),"")
L20:L51L20=IF(J20<>"",SUMPRODUCT(IFERROR((J20<=J$20:J$1000)*(J$20:J$1000<>"")/COUNTIF(J$20:J$1000,J$20:J$1000),0)),"")
J34:J51J34=IF(E34<>"",(F34*4.55)-(G34*5),"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D20:K51Expression=$K20=MIN($K$44:$K$75)textNO
D20:K51Expression=AND($D20>=2,$D20<>"",$I20>=0.6,$I20<>"")textNO
C19:E19,C17:D17,D18Expression=AND($AO11>0,$AQ11>=2,$AR11>=0.6)textNO
C19:E19,C17:D17,D18Cell Value<0textNO
I19:K19Expression=#REF!=#REF!textNO
I19:K19Expression=AND(#REF!>=0.6,#REF!>1)textNO
I19:K19Expression=AND(#REF!<=0.525,#REF!>1)textNO
 
Upvote 0
I keep forgetting about some version differences. What if you confirm the formula in L20 with Ctrl+Shift+Enter, not just Enter, before copying it down?
 
Upvote 0
Solution
I keep forgetting about some version differences. What if you confirm the formula in L20 with Ctrl+Shift+Enter, not just Enter, before copying it down?
I did not think of an array.....and it WORKS!
Thank you.

Cell Formulas
RangeFormula
D20:D38D20=IFERROR($F20+$G20,"")
E20:E38E20=IFERROR(LOOKUP(2, 1/((COUNTIF(E$19:$E19,'[My Wagers.xlsm]NBA'!$H$324:$H$501)=0)*('[My Wagers.xlsm]NBA'!$H$324:$H$501<>"")),'[My Wagers.xlsm]NBA'!$H$324:$H$501),"")
F20:F38F20=IFERROR(COUNTIFS('[My Wagers.xlsm]NBA'!$A$324:$A$501,"W",'[My Wagers.xlsm]NBA'!$H$324:$H$501,"<>",'[My Wagers.xlsm]NBA'!$H$324:$H$501,$E20)+$H20*0.5,"")
G20:G38G20=IFERROR(COUNTIFS('[My Wagers.xlsm]NBA'!$A$324:$A$501,"L",'[My Wagers.xlsm]NBA'!$H$324:$H$501,"<>",'[My Wagers.xlsm]NBA'!$H$324:$H$501,$E20)+$H20*0.5,"")
H20:H38H20=IF(E20<>"",COUNTIFS('[My Wagers.xlsm]NBA'!$A$324:$A$501,"Psh",'[My Wagers.xlsm]NBA'!$H$324:$H$501,"<>",'[My Wagers.xlsm]NBA'!$H$324:$H$501,$E20),"")
I20:I38I20=IFERROR($F20/($F20+$G20),"")
J20:J33J20=IF(E20<>"",ROUND((F20*4.55)-(G20*5),2),"")
K20:K38K20=IF(J20<>"",SUMPRODUCT((J20<=$J$20:$J$35)/COUNTIF($J$20:$J$35,$J$20:$J$35)),"")
L20:L35L20=IF(J20<>"",SUMPRODUCT(IFERROR((J20<=J$20:J$1000)*(J$20:J$1000<>"")/COUNTIF(J$20:J$1000,J$20:J$1000),0)),"")
J34:J38J34=IF(E34<>"",(F34*4.55)-(G34*5),"")
L36:L38L36=IF(J36<>"",SUMPRODUCT(IFERROR((J36<=J$20:J$1000)*(J$20:J$1000<>"")/COUNTIF(J$20:J$1000,J$20:J$1000),0)),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D20:K51Expression=$K20=MIN($K$44:$K$75)textNO
D20:K51Expression=AND($D20>=2,$D20<>"",$I20>=0.6,$I20<>"")textNO
C19:E19,C17:D17,D18Expression=AND($AO11>0,$AQ11>=2,$AR11>=0.6)textNO
C19:E19,C17:D17,D18Cell Value<0textNO
I19:K19Expression=#REF!=#REF!textNO
I19:K19Expression=AND(#REF!>=0.6,#REF!>1)textNO
I19:K19Expression=AND(#REF!<=0.525,#REF!>1)textNO
 
Upvote 0
You're welcome. Glad it works now. Sorry it took me so long to think of that. o_O
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,217
Members
453,024
Latest member
Wingit77

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