ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   undefined function error when creating xls pivot from mdb qry (https://www.excelbanter.com/excel-worksheet-functions/37790-undefined-function-error-when-creating-xls-pivot-mdb-qry.html)

andrew

undefined function error when creating xls pivot from mdb qry
 
Happens for both user-defined and built-in functions.

This "ExtractElement" function works in Access when used in a query, and
works in Excel when used as a formula." When attempting to create a
pivottable that points to the Access query using this formula, I get a
"Undefined function 'ExtractElement' in expression" error message. I was
attempting to work around this by using the InStrRev function in the query
the pivottable will point to, but get the same error message for that
built-in function as well: "Undefined function 'InStrRev' in expression." Is
there a setting that has to be enabled for Excel to recognize user-defined or
built-in functions being used in a query excel is to make a pivottable out
of? Thank you.

Public Function ExtractElement(str, n, sepChar)
' Returns the nth element from a string,
' using a specified separator character
Dim x As Variant
x = Split(str, sepChar)
If n 0 And n - 1 <= UBound(x) Then
ExtractElement = x(n - 1)
Else
ExtractElement = ""
End If
End Function



All times are GMT +1. The time now is 06:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com