Formula To User Defined Function

bloodmilksky

Board Regular
Joined
Feb 3, 2016
Messages
202
Hi Guys,

I was just wondering if anyone knows how to turn the below formula into a user defined function? for VBA

=IFERROR(INDEX('Hidden Sheet'!B2:B19,MATCH(B7,Employees,0)),"")

Many thanks

Jamie
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
VBA is significantly slower that native excel and uses more resources.
There is a disadvantage in creating a UDF for that.
The formula as it is fine.
 
Upvote 0
my thought was is that I didnt want the users to be able to amend or interfer with the formula and thought that setting it up as a UDF would help me accomplish this.
 
Upvote 0
Users can mess with UDF's as easily as they can with native formula.
The most common error would be to enter the wrong cell addresses or the wrong relative referencing. Switching to a UDF wouldn't address that at all.
(And, if your users feel free to alter formulas, I'd not encourage them to get into the VBE. :) )

One thought that I had about your formula is that if you sort the Employees range, you could use the formula
=IFERROR(LOOKUP(B7, Employees, 'Hidden Sheet'!B2:B19), "")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,399
Latest member
alchavar

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