Offset to the address of the next occupied cell

gtd526

Well-known Member
Joined
Jul 30, 2013
Messages
657
Office Version
  1. 2019
Platform
  1. Windows
Hello,
Looking to Offset (or other formula) to reference the cell address of the next occupied cell moving up.
Cabinets(O:O) to 6 (N:N)
Mbath to 6
etc

No arrays please. I have to incorporate this into another formula that's not an array.
When there are multiple summary's for one invoice, I need to reference the first occupied cell address (N:N).

Thank you.


Cell Formulas
RangeFormula
N15:N17,N13,N11,N7:N8N7=IFERROR(INDEX($A:$A, MATCH(0, IF($O$3=$C:$C, COUNTIF($N$6:$N6, $A:$A), ""), 0)),"")
O7O7=IFERROR(IF(COUNTIF($A$2:$A$100, $N7)=1,INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N7=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O6,0))),1)),INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N$7=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O6,0))),1))),"")
O8:O10O8=IFERROR(IF(COUNTIF($A$2:$A$100, $N8)=1,INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N8=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O7,0))),1)),INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N$8=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O7,0))),1))),"")
O11:O12O11=IFERROR(IF(COUNTIF($A$2:$A$100, $N11)=1,INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N11=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O10,0))),1)),INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N$11=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O10,0))),1))),"")
O13:O14O13=IFERROR(IF(COUNTIF($A$2:$A$100, $N13)=1,INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N13=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O12,0))),1)),INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N$13=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O12,0))),1))),"")
O15O15=IFERROR(IF(COUNTIF($A$2:$A$100, $N15)=1,INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N15=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O14,0))),1)),INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N$15=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O14,0))),1))),"")
O16O16=IFERROR(IF(COUNTIF($A$2:$A$100, $N16)=1,INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N16=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O15,0))),1)),INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N$16=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O15,0))),1))),"")
O17O17=IFERROR(IF(COUNTIF($A$2:$A$100, $N17)=1,INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N17=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O16,0))),1)),INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N$17=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O16,0))),1))),"")
O18O18=IFERROR(IF(COUNTIF($A$2:$A$100, $N18)=1,INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N18=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O17,0))),1)),INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N$18=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O17,0))),1))),"")
O19O19=IFERROR(IF(COUNTIF($A$2:$A$100, $N19)=1,INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N19=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O18,0))),1)),INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N$19=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O18,0))),1))),"")
O20O20=IFERROR(IF(COUNTIF($A$2:$A$100, $N20)=1,INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N20=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O19,0))),1)),INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N$20=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O19,0))),1))),"")
O21O21=IFERROR(IF(COUNTIF($A$2:$A$100, $N21)=1,INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N21=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O20,0))),1)),INDEX($I$3:$I$100,AGGREGATE(15,6,(ROW($I$3:$I$100)-ROW($I$3)+1)/($N$21=$A$3:$A$100)/(ISNA(MATCH($I$3:$I$100,O$6:O20,0))),1))),"")
Q7:Q21Q7=IFERROR(IF(COUNTIFS($A:$A, $N7,$A:$A,"<>")>=2,SUMIF(A:A,$N7,L:L),(INDEX(L:L,MATCH(N7,A:A,0)))),"")
Q22Q22=SUM(IF(ISERROR(Q7:Q21),"",Q7:Q21))
Press CTRL+SHIFT+ENTER to enter array formulas.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
In R7 and filled down, this formula will give you the Invoice # of the last non-blank cell in column N. Not sure if that's what you're after, though.

=LOOKUP(2,1/($G$7:G7<>""),$G$7:G7)

By extension, this would give you the address of the cell that contains that Invoice #:

=ADDRESS(MATCH(LOOKUP(2,1/($G$7:G7<>""),$G$7:G7),G:G,0),14)
 
Upvote 0
Solution
In R7 and filled down, this formula will give you the Invoice # of the last non-blank cell in column N. Not sure if that's what you're after, though.

=LOOKUP(2,1/($G$7:G7<>""),$G$7:G7)

By extension, this would give you the address of the cell that contains that Invoice #:

=ADDRESS(MATCH(LOOKUP(2,1/($G$7:G7<>""),$G$7:G7),G:G,0),14)
I had to adjust the Column Letter to N:N from G:G.
I incorporated it into my previous formula, and it WORKS!
I can use your first formula or the 2nd one. They both have the same result.
Thank you.
 
Upvote 0
Glad it worked. Sorry about the column G mix-up, forgot to adjust that bit. :)
 
Upvote 0
Wouldn't this very simple operation do the same job?

22 07 30.xlsm
NOPQR
6Invoice(s)SummaryPriceInvoice
72Door Hinge$100.002
86Install Lighting$500.006
9Cabinets6
10Mbath6
118Walls$280.008
12Floor Rug8
139Patch Walls$450.009
14Thin Set Grout9
1510Lights$300.0010
1611Ceiling$50.0011
17011
Inv
Cell Formulas
RangeFormula
R7:R17R7=IF(N7="",R6,N7)
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,893
Members
449,097
Latest member
dbomb1414

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