Help with converting xlookup equation into a custom function with one input.

rorymac

New Member
Joined
Nov 24, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
  2. Web
Hi,

I did use match, index and lookup but now use the xlookup to collate relevant data from different tables for information when adding new data to the new new table. Ie copy contact information to help identify the client to add more data against that client.

I have generated an equation that does this, see below, but even though xlookup simplifies the equation, putting in new tales, copying the equation to another sheet I still manage to misspell something, or it take a while to fully understand the equation again to get it working again. I have tried to write a custom function with one variable input but failed.

I was usign the xlookup as
lookup_value - This will always be the first row of the new table and entered manually, townlink reference, and will be a unique name for one property across all tables. .
lookup_array - The first row, townlink reference of the table that data being extracted from.
return_array - The row in the table with the data beign extracted.


To reduce my manual input and thus less likely to get errors I used variables in rows 2 and 3 that I can change rather than change the actual equation. I hide rows 2 & 3 after table setup.
A3 - is the name of the new table, so when generate another new table I can change this, and it will correct the equation
B2 - is the name of the table the data is being extracted from; each column can be extracting from different tables.
B3 - is equal B5 and the variable to be extracted. I could not get the equation working by referencing the table heading directly.

I have tried to write a custom equation, as it should only require one variable, the name of the table the data is being extracted from. Thats if the other inputs above can be obtained automatically from the cell location?

The formular without referencing the cells above is below for reference.
=XLOOKUP(tbl_Attic[@[TownLink referance]:[TownLink referance]],tbl_Contacts[[#All],[TownLink referance]:[TownLink referance]],tbl_Contacts[[#All],[SEAI reference]],"error")

The mini sheet for both tabs below. Any help will be a greatly received.

Book1.xlsm
ABCDEFGHIJKLM
1
2tbl_Contactstbl_Contactstbl_Contactstbl_ContactsTable3
3tbl_Townlink_WOSEAI referenceSEAI database linkSurnameTL AddrPM
4Atic
5TownLink referanceSEAI referenceSEAI database linkSurnameTL AddrPMAttic 100mmAttic 100mm2Attic 100mm3Attic 100mm4Attic 100mm5IWI: SlopedLL Roof vent
6D190WH571##Ske264Rory60431109800
7D191WH576##Sta4 GLDara
8D192WH591##O C54 ODara45
9D193WH631##Wal62 SDerek461
10D194WH634##Mar81 TDara401
Townlink_WO
Cell Formulas
RangeFormula
B3B3=tbl_Townlink_WO[[#Headers],[SEAI reference]]
C3C3=tbl_Townlink_WO[[#Headers],[SEAI database link]]
D3D3=tbl_Townlink_WO[[#Headers],[Surname]]
E3E3=tbl_Townlink_WO[[#Headers],[TL Addr]]
B6:F10B6=XLOOKUP(INDIRECT($A$3&"[@[TownLink referance]:[TownLink referance]]"),INDIRECT(B$2&"[[#All],[TownLink referance]:[TownLink referance]]"),INDIRECT(B$2&"[[#All],["&B$3&"]]"),"error")


Book1.xlsm
ABCDEFGH
1
2
3TownLink referanceSEAI referenceTitleFirstSurnameTL addrEircodeTL Primary Phone Number
4D190WH571 Mr264Ske264
5D191WH576 Mr4 GLSta4 GL
6D192WH591 Mrs54 OO C54 O
7D193WH631 Ms62 SWal62 S
8D194WH634 Ms81 TMar81 T
9
10
11
12TownLink referancePM
13D190Rory
14D191Dara
15D192Dara
16D193Derek
17D194Dara
Contacts
Cell Formulas
RangeFormula
D4:D8D4=LEFT([@[TL addr]],4)
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,223,099
Messages
6,170,111
Members
452,302
Latest member
TaMere

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