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

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
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,223,246
Messages
6,170,988
Members
452,373
Latest member
TimReeks

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