User-defined functions (UDFs) are VBA procedures that typically take inputs (although inputs are not mandatory) to return a result to either a worksheet cell, or to another VBA procedure. By design UDF's that are called from a worksheet should only return a value to the cell from where the function was called - the UDF should not modify the contents or formatting of any cell, or the operating environment of Excel (there are workarounds to this design).
Questions tagged [excel-udf]
99 questions
0
votes
0 answers
Why doesnt this function work what it calls onitself? Excel VBA
I am trying to make a UDF that does integration on function specified in some cell.
for that i have made this beautiful function that almost works:
Function EvaluateFormula(ByVal Variable As Double, ByVal FormulaCell As Range) As Double
Dim…

Rihards Roziņš
- 1
- 1
0
votes
1 answer
How to save Lambda formula as Excel Add-In (or how to easily convert to VBA function?)
I made some very complex Lambda formulas which I use frequently to validate UPC Check digits, and convert UPCs from UPC-E to UPC-A format
I tried to set them up as named ranges, then save the workbook as an Add-In, and followed all the steps I could…

Andy L
- 93
- 6
0
votes
0 answers
Unable to find source for mystery Excel User Defined Functions appearing in the "Insert Function" dialog box
My list of User Defined Functions contains 118 unknown and unidentifiable functions that I can't identify or delete. These UDF's appear to be associate with the Excel Solver, and are named using several different languages (French, Italian, English,…

Fester
- 1
0
votes
0 answers
Array function (UDF) only sets first cell in a row
I need to output to multiple cells in a row from an UDF and I tried this solution:
https://stackoverflow.com/a/43669306/90800
Function tester()
tester = Array("a", "b", "c")
End Function
However, only the first cell contains "a".

Alexander Zeitler
- 11,919
- 11
- 81
- 124
0
votes
1 answer
Unable to write response in Excel using ExcelDNA in C#
I'm unable to write my REST API response in Excel using ExcelDNA in C#. It is working fine with reading values from specific column.
xlCell[i, 1] = "TEST"; // fails with System.Runtime.InteropServices.COMException: 'Exception from HRESULT:…

Aniket K
- 1
- 3
0
votes
0 answers
VBA Custom Function Working in immediate window but not in Worksheet? Throwing #VALUE Error
I'm trying to get exp. Moving Average of Some quote. I build a custom function to retrieve it in my sheet. when I'm trying to execute in cell, it throws #Value Error. But when I execute it in immediate window it runs perfectly. even I've tried to…

Vijay Pal
- 1
- 1
0
votes
0 answers
What Excel VBA or UDF options exist to look up values in a closed workbook
I currently use a UDF to look up values from a table in my personal workbook and it works just as I need it to. However I was hoping to be able to share this UDF with other people I work with. I have mine saved in a .xlam and loaded as an addin. I…

Derek
- 155
- 13
0
votes
3 answers
custom function in excel using vba that works in any matchine
I have created a custom function via vba in excel. If I use it in my computer, it works ok, but if I change the file to another computer (where this computer also has the created function), it does not work. I must change the path of the created…

Mouse
- 1
0
votes
1 answer
Shorten excel formula by user defined function VBA
My ultimate goal is to shorten this formula using a user definded function in VBA, with the following as my parameter A1:C10, A1:A10, E1, B1:B10, F1 (this will vary, this is just an pure example)
Excel formula:…

Kira
- 1
0
votes
0 answers
Application.Volatile help - Excel VBA
I am working on building a budget file in Excel:
in row 2 I have the months
in Column A I have my budget types (categories).
Rather than build a bunch of sumifs in each individual cell, I'm trying to write a custom VBA function for each input…

belzinga
- 21
- 1
- 2
0
votes
2 answers
Range to Column in Excel using VBA
I am trying to create a function as follows:
Input: range
Output: column that contains all the non-empty cells in the range.
For example, on input
A | B | C | D
--------------
1 | 2 | | 3
4 | | 5 |
The output should be
A
--
1
2
3
4
5
Here's…

Dudi Frid
- 152
- 7
0
votes
0 answers
Excel copy sheet along with module code to new book
I am trying to copy a sheet from one file to another and get the VBA to come along with it. The source sheet has formulae, which are based on UDF's. They are located in a module in the source book.
When I copy the sheet, the module does not come…
0
votes
2 answers
Circular Error in VBA User defined Function
I am new to the VBA programming and have written a VBA function for interpolation.
I attempt to get the input from cell C17 and other cell in column Cto the function "WindPressure"
The function then gets the input from column C( Height above ground…
0
votes
0 answers
VBA - Convert range to variant
I am stuck in the conversion from range to variant.
For the function of percentageAbove, I want to remove elements that is 0 and then use the inputs in percentageAboveHelper. For example, if
xInput is 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
yInput is 5, 0,…

Pak Ho Cheung
- 1,382
- 6
- 22
- 52
0
votes
2 answers
Excel VBA macros and error messages
I'm very inexperienced in Excel and I'm running into a problem programming a macro. It simply stops without any error dialog, no matter whether I set a breakpoint and step over or not.
Am I missing something? Do I have to turn on error messages…

moozeeque
- 1
- 1