Convert Index Match to User Defined Function

c1todd

New Member
Joined
May 29, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello, I'm new VBA and have been trying to covert a standard Index Match function to a User Defined Function in VBA to simplify the formula for users. (As I understand it, since the cell the function is in will change a UDF is required.) I have three functions I'm trying to figure out. I'm using the index match because the column position being searched for could change (although I'm not tied to that if there are better options). I'm using PowerPivot as well as referencing different sheets/tabs within the same workbook. I'm hoping to next these formulas within sumifs if possible. I've attached a picture of the full formula and the tabs, hopefully that helps. Unfortunately, I can't install the XL2BB add-in for the spreadsheet. Could someone please help? Thank you in advance!

INDEX(Financials!$A:$XDF,1,MATCH("Year",Financials!$A$1:$XDF$1,0))

"<= "&MAX(INDEX(DateSelection!$A:$XDF,1,MATCH("Week Number",DateSelection!$A$1:$XDF$1,0)))

XLOOKUP(MAX(INDEX(DateSelection!$A:$XDF,1,MATCH("Week Number",DateSelection!$A$1:$XDF$1,0))),INDEX(DateSelection!$A:$XDF,1,MATCH("Week Number",DateSelection!$A$1:$XDF$1,0)),INDEX(DateSelection!$A:$XDF,1,MATCH("Year",DateSelection!$A$1:$XDF$1,0)))
 

Attachments

  • UDF_Screenshot.png
    UDF_Screenshot.png
    86 KB · Views: 19

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,223,882
Messages
6,175,164
Members
452,615
Latest member
bogeys2birdies

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