Using Application.Match with a Structured Table

Calgary_Neil

Board Regular
Joined
Apr 5, 2014
Messages
79
Hi feeling dumb today,

I have a Structured Table called Experience with 2 columns Lvl, and Title and want find the CrtLvl (Current Level) of the CrtTitle (Current Title) using
CrtLvl = Application.Match( CrtTitle, Experience[Title], 0)

In this case the level = row number, but it could be expanded by wrapping this in a similar Index call.
What I'm not getting is how to wrap "Experience[Title]".
Being a onetime call I don't want to create to many variables, and being a Structured Table isn't the name globally predefined?
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Try:
VBA Code:
CrtLvl = Application.Match(CrtTitle, Sheets("Sheet1").ListObjects("Experience").ListColumns("Title").Range, 0)
change Sheets("Sheet1") to suit.
 
Upvote 0
being a Structured Table isn't the name globally predefined?
Yes, that is my understanding.

You can try:
VBA Code:
    CrtLvl = Application.Match(CrtTitle, Range("Experience[Title]"), 0)

Note: this counts from starting from the first data row. @Akuini's code starts counting from the heading row. Change Akuini's code to the below to have it start at the 1st data row
VBA Code:
CrtLvl = Application.Match(CrtTitle, Sheets("Sheet1").ListObjects("Experience").ListColumns("Title").DataBodyRange, 0)
 
Upvote 0
Solution
@Alex Blakenburg Uggh, I thought I had tried that. Thanks

Both I didn't like the sheets method because it reduces the effectiveness of the global variable by tying it to A sheet. It is interesting how the two different calls differ.
Thank you both for replying
 
Upvote 0
Thanks for letting us know. Glad we could help.
FYI: rngTitle.Parent.Name will get you the sheet name of the sheet the table is on.
 
Upvote 0

Forum statistics

Threads
1,214,891
Messages
6,122,105
Members
449,066
Latest member
Andyg666

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