How to fix this #VALUE error?

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,676
Office Version
  1. 365
Platform
  1. Windows
In the minisheet below, I get a #VALUE error for the call to my GetFormula UDF that I have used for years. In an attempt to identify the error, I added a breakpoint.

1718654140101.png


It never got called. I wondered if in my migration of files from my old Win 10 laptop to my new Win 11 laptop, I might have made another copy of my add-in module which is where these UDFs are stored. But then I added a call to my GetFormat UDF which is right next to the GetFormula UDF in the same add-in module. That breakpoint was executed.

1718655125464.png


Why would one UDF in the same add-in module get executed and another one not? Is there a way I can find out what module the code is calling?

I ran several searches for "getformula(" in all of the active modules and got no hits.

I also found it puzzling that the call to GetFormula insisted on mixed case (that matches the declaration in the add-in module), but the call to getformat insists on all lower case, which does not match the declaration.

FormulaText.xlsx
CDE
53#VALUE!General
Cell Address
Cell Formulas
RangeFormula
C5C5=1+2
D5D5=GetFormula(C5)
E5E5=getformat(C5)
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I haven't succumbed to Windows 11 yet, but one possible way to troubleshoot: in an empty cell, click the F(x) button to bring up the function selection dialog box, and in the Category dropdown select User Defined. That should tell you all UDFs that you have available, for example if there is a version in PERSONAL.XLSB or something.

Also, if you're getting past the function call, try debugging it by changing it to
Code:
GetFormula = "dummy value"
to see if that part will go through.

Another thing to try maybe open Excel in safemode (no addins, customizations, etc) then open your module and try on a blank file.
 
Upvote 0
I haven't succumbed to Windows 11 yet, but one possible way to troubleshoot: in an empty cell, click the F(x) button to bring up the function selection dialog box, and in the Category dropdown select User Defined. That should tell you all UDFs that you have available, for example if there is a version in PERSONAL.XLSB or something.
Here's what that gets. What does that mean?
1718662319280.png


Also, if you're getting past the function call, try debugging it by changing it to
Code:
GetFormula = "dummy value"
to see if that part will go through.
I changed it to this. Same result.
1718662578694.png


Another thing to try maybe open Excel in safemode (no addins, customizations, etc) then open your module and try on a blank file.
I'll do that next...
 
Upvote 0
I closed all Excel workbooks, then opened Excel in safe mode. I did that by clicking on the Excel icon while holding down the Ctrl key and then clicking "Yes" when asked if I wanted to open it in safe mode. I then typed "=getformula(C4)" in an empty cell. I was not prompted with the UDF name as I had been and I got a #NAME error. I cannot attach a minisheet because xl2bb is also not active. This is curious, because when I open the Add-ins dialog, it shows both as checked.

1718665231982.png


Now what?
 
Upvote 0
I changed the name of the UDF to GetFormulax and it works. And the breakpoint worked, so it was executing that UDF. I changed it back and it got the #VALUE error.

Next, I opened a new workbook, added a code module, and copied the UDF intact to that code module. It worked.
 
Upvote 0
I paused Carbonite (which sometimes grabs ahold of files and causes problems), closed everything, rebooted, and tried again. Same problem.

I give up. I renamed my GetFormula UDF to MyFormulaText. It works. If anyone has any other ideas, I can try them.

This problem has cost me several hours of my time today and there is no solution. Things like this are happening more and more often. When they do, I literally hate M$FT. A good friend of mine recently switched to a Mac. She loves it. It just works. She doesn't write code, but I may have to look into that. 🤨😡🤬
 
Upvote 0
Just grasping at straws here. You don't have anything in Name Manager do you ?

1718677571179.png


Book1
ABCD
1
2InputFormula=GetFormula(B3)=GetFormat(B3)
35060=10+A3General
Sheet1
Cell Formulas
RangeFormula
C2:D2C2=FORMULATEXT(C3)
B3B3=10+A3
C3C3=GetFormula(B3)
D3D3=GetFormat(B3)
Lambda Functions
NameFormula
GetFormat=LAMBDA(rcell,GET.CELL(7,rcell))
GetFormula=LAMBDA(rcell,GET.CELL(6,rcell))
 
Upvote 0
Just grasping at straws here. You don't have anything in Name Manager do you ?

If I open Name Manager in that workbook, I see:

1718682402146.png


I don't know what I should do with the rest of your post:

Book1
ABCD
1
2InputFormula=GetFormula(B3)=GetFormat(B3)
35060=10+A3General
Sheet1
Cell Formulas
RangeFormula
C2:D2C2=FORMULATEXT(C3)
B3B3=10+A3
C3C3=GetFormula(B3)
D3D3=GetFormat(B3)
Lambda Functions
NameFormula
GetFormat=LAMBDA(rcell,GET.CELL(7,rcell))
GetFormula=LAMBDA(rcell,GET.CELL(6,rcell))
 
Upvote 0
I have tested hiding the name in Name Manager and the function still works, so it not showing in name manager is not conclusive. However it sounds like you haven't experimented with using the Macro4 option as an alternative to a UDF so it would seem unlikely that there is a conflicting function in name manager.

The rest of the post was just in case it piqued your or any other visitors to the post's interest in having an alternative to a UDF for these functions. I do understand that you have it installed through and add-in and there are some benefits to using it that way.
 
Upvote 0
I changed the name of the UDF to GetFormulax and it works. And the breakpoint worked, so it was executing that UDF. I changed it back and it got the #VALUE error.

Next, I opened a new workbook, added a code module, and copied the UDF intact to that code module. It worked.
I tried both of your UDFs and they both worked (365).

As a longshot, is it possible that you have a version of GetFormula() saved in your personal macro workbook (Excel15.xlb)?

Book1
BCDEF
4
53C5: =1+2General
6
Sheet2
Cell Formulas
RangeFormula
C5C5=1+2
D5D5=GetFormula(C5)
E5E5=getformat(C5)
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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