Extract originating cell reference of consolidated worksheets

henryg

Board Regular
Joined
Oct 23, 2008
Messages
152
Office Version
  1. 365
Platform
  1. Windows
I have a PQ that consolidates various worksheets, and on that "Summary" added a column with the originating table names. All good so far other than PQ imports table names containing '-' with '_', hence the "Replaced Underscores" code.

I would also like the originating worksheet cell reference in a column but can't get it to work that even using AIs. The M code is below. Anything I can do?

let
Source = Excel.CurrentWorkbook(),
#"Filtered Rows" = Table.SelectRows(Source, each Text.StartsWith([Name], "hFirst") or Text.StartsWith([Name], "Joint")),
#"Sorted Rows" = Table.Sort(#"Filtered Rows",{{"Name", Order.Ascending}}),
#"Expanded Content" = Table.ExpandTableColumn(#"Sorted Rows", "Content", {"Date", "Description", "Amount", "Notes"}, {"Date", "Description", "Amount", "Notes"}),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Content",{{"Date", type date}}),
#"Filtered Rows1" = Table.SelectRows(#"Changed Type", each true),
#"Filtered Rows2" = Table.SelectRows(#"Filtered Rows1", each ([Date] <> null) and ([Description] <> "Opening balance")),
#"Renamed Columns" = Table.RenameColumns(#"Filtered Rows2",{{"Name", "Table Name"}}),
#"Replaced Underscores" = Table.TransformColumns(#"Renamed Columns", {"Table Name", each Text.Replace(_, "_", "-"), type text})
in
#"Replaced Underscores"

Ideally I would like to have hypertext links to the originating data.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
After much trial and error and messing in PQ, and finally in Excel I get the originating cell location, by:

Formula: =TEXTAFTER(CELL("address",XLOOKUP(C4,INDIRECT(E4&"[Amount]"),INDIRECT(E4&"[Amount]"))),"]",1)

Result: h_1999'!$C$6

h_1999 is the worksheet name (although it is also a table name).

How/can this become a live hyperlink? There are over 8000 rows so it needs to be via a formula or vba
 
Upvote 0

Forum statistics

Threads
1,224,910
Messages
6,181,677
Members
453,061
Latest member
schiefA

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