Use Cell Address in Formula

MrDB4Excel

Active Member
Joined
Jan 29, 2004
Messages
334
Office Version
  1. 2013
Platform
  1. Windows
How to Use the Cell Address Shown in One Cell for Another Cell's Formula
I cannot seem to get this to work. I have tried several ways and all return error or #VALUE or some such.
The attached XL2BB shows the layout of this worksheet, which is similar to 18 worksheets in this workbook, but with varying number of rows.
The reason I am trying to get this to work is when files are added to folders then the cells A1 & A2 update the end portion of the range per the cell address value shown in E3.
So for example in this worksheet there are now 8 files showing from the Power Query, consequently cell A1’s range is G5:G12 (G12 matches the row number in $H$12).
When one or more files are added to this folder and the Power Query is refreshed then that number of new files changes the cell address in E3 from $H$12 to $H$??. It is this new row number value I want to auto-update the row number in cells A1 & A2 formula’s end portion of the range G5:G??.
Does this make sense? I would very much appreciate any input on this, thank you.

I saw a mention of combining cell address and indirect, but the link to explain did not provide an answer to my specific situation. Maybe I did not research far enough, but it seemed to be a dead-end.
dodge.xlsm
ABCDEFGHI
18F:\Dwight\Memoirs\Docs\dodge\CRPS\2z8TOC112
20dodge\CRPS\2z<<< Jump To This Sheet's Link In The Summary Sheet8
38dodge\CRPS2<<< This Sheet's Name$H$12
4IndexFile NameContaining FolderConcatenated File NameHyperlinksDate Modified
51CRPS Design Narrative.docxF:\Dwight\Memoirs\Docs\dodge\CRPS\F:\Dwight\Memoirs\Docs\dodge\CRPS\CRPS Design Narrative.docxF:\Dwight\Memoirs\Docs\dodge\CRPS\CRPS Design Narrative.docx03/25/2020 14:4511
62CRPS Design Narrative.pdfF:\Dwight\Memoirs\Docs\dodge\CRPS\F:\Dwight\Memoirs\Docs\dodge\CRPS\CRPS Design Narrative.pdfF:\Dwight\Memoirs\Docs\dodge\CRPS\CRPS Design Narrative.pdf03/25/2020 14:4522
73CRPS Developer Search.docxF:\Dwight\Memoirs\Docs\dodge\CRPS\F:\Dwight\Memoirs\Docs\dodge\CRPS\CRPS Developer Search.docxF:\Dwight\Memoirs\Docs\dodge\CRPS\CRPS Developer Search.docx03/25/2020 15:1833
84Development of CRPS.docxF:\Dwight\Memoirs\Docs\dodge\CRPS\F:\Dwight\Memoirs\Docs\dodge\CRPS\Development of CRPS.docxF:\Dwight\Memoirs\Docs\dodge\CRPS\Development of CRPS.docx03/10/2020 23:1744
95fore-and-aft rigged boat sail at DuckDuckGo.urlF:\Dwight\Memoirs\Docs\dodge\CRPS\F:\Dwight\Memoirs\Docs\dodge\CRPS\fore-and-aft rigged boat sail at DuckDuckGo.urlF:\Dwight\Memoirs\Docs\dodge\CRPS\fore-and-aft rigged boat sail at DuckDuckGo.url12/29/2019 10:3155
106Lori Greiner-Shark Tank.docxF:\Dwight\Memoirs\Docs\dodge\CRPS\F:\Dwight\Memoirs\Docs\dodge\CRPS\Lori Greiner-Shark Tank.docxF:\Dwight\Memoirs\Docs\dodge\CRPS\Lori Greiner-Shark Tank.docx04/10/2020 07:3966
117square rigged boat sail at DuckDuckGo.urlF:\Dwight\Memoirs\Docs\dodge\CRPS\F:\Dwight\Memoirs\Docs\dodge\CRPS\square rigged boat sail at DuckDuckGo.urlF:\Dwight\Memoirs\Docs\dodge\CRPS\square rigged boat sail at DuckDuckGo.url12/29/2019 10:3077
128WVDS Developer Search Pre11Mar-Changes.docxF:\Dwight\Memoirs\Docs\dodge\CRPS\F:\Dwight\Memoirs\Docs\dodge\CRPS\WVDS Developer Search Pre11Mar-Changes.docxF:\Dwight\Memoirs\Docs\dodge\CRPS\WVDS Developer Search Pre11Mar-Changes.docx03/11/2020 12:2188
13
14A1 Formula: =COUNT(G5:G12)
15A2 Formula: =SUMPRODUCT(--NOT(ISNUMBER(G5:G12)))
16E3 Formula: =CELL("address",INDEX(H:H,MATCH(MAX(H:H),H:H,0)))
2
Cell Formulas
RangeFormula
A1A1=COUNT(G5:G12)
B1B1=RIGHT(C5,LEN(C5)-0)
C1C1=LEFT(C3,1)&"z"
I1I1=SUMPRODUCT(MAX((H:H<>"")*ROW(H:H)))
A2A2=SUMPRODUCT(--NOT(ISNUMBER(G5:G12)))
B2B2=MID(B1, FIND(CHAR(1),SUBSTITUTE(B1,"\",CHAR(1),4))+1, FIND(CHAR(1),SUBSTITUTE(B1,"\",CHAR(1),5)) - FIND(CHAR(1),SUBSTITUTE(B1,"\",CHAR(1),2))-1)
C2C2=C1
D2D2=HYPERLINK("#"&CELL("address",INDEX(Summary!$E$2:$E$30,MATCH($C$2,Summary!$E$2:$E$30,0))),"<<< Jump To This Sheet's Link In The Summary Sheet")
A3A3=SUM(A1:A2)
B3B3=LEFT(B2,LEN(B2)-1)
C3C3=MID(CELL("filename",C3),FIND("]",CELL("filename",C3))+1,32)
E1E1=COUNT(H:H)
E2E2=MAX(H:H)
E3E3=CELL("address",INDEX(H:H,MATCH(MAX(H:H),H:H,0)))
A5:A12A5=VLOOKUP('2z'!$A5,'2z'!$A:$A,COLUMN('2z'!$A:$A)-COLUMN('2z'!$A:$A)+1,0)
B5:B12B5=VLOOKUP('2z'!$B5,'2z'!$B:$B,COLUMN('2z'!$B:$B)-COLUMN('2z'!$B:$B)+1,0)
C5:C12C5=VLOOKUP('2z'!$C5,'2z'!$C:$C,COLUMN('2z'!$C:$C)-COLUMN('2z'!$C:$C)+1,0)
D5:D12D5=CONCATENATE(C5,B5)
E5:E12E5=HYPERLINK(D5)
F5:F12F5=VLOOKUP('2z'!$D5,'2z'!$D:$D,COLUMN('2z'!$D:$D)-COLUMN('2z'!$D:$D)+1,0)
G5:G12G5=A5
Named Ranges
NameRefers ToCells
'2z'!ExternalData_1='2z'!$A$4:$D$12A5:A12
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A5:F13,A17:F222,A14:A16,C14:F16Expression=AND($A5<>"",$G$1=ROW())textNO
 

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.
Why not just use a large enough range in the A1 & A2 formulas to easily cover the expected number of eventual files then you never have to change those two formulas?
Might mean amending the style of formula a bit but should be doable.

For example, in A1, why not
=COUNT(G5:G1000)
 
Upvote 0
Will do, Peter. I thought of this earlier, but always trying to learn new, more difficult formulas.
Thanks
If someone else comes along with such a formula to do what I am asking about then I would try that too.
Certainly, surely, there must be a method to include one cell's cell address that resulted from that cell's address lookup and be able to include that result in another formula's range.
But then what do I know, I assure you not enough but always willing to learn new ways.
 
Upvote 0
surely, there must be a method to include one cell's cell address that resulted from that cell's address lookup and be able to include that result in another formula's range.
You can - using the INDIRECT function. Something like
=COUNT(INDIRECT("H5:"&E3))
However, INDIRECT is a volatile function so generally best to avoid where other alternatives are available.
 
Upvote 0
Thanks, Peter. This will certainly be a good thing to learn regardless.
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,072
Latest member
DW Draft

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