ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   EVALUATE method returns zero (https://www.excelbanter.com/excel-programming/405965-evaluate-method-returns-zero.html)

Rob

EVALUATE method returns zero
 
I have a UDF which uses EVALUATE ( )

If I take the contents of the bracket and put it into a cell then Excel
calculates the correct answer, but I get zero from Evaluate.

The contents of the bracket is a SUMPRODUCT formula.



Niek Otten

EVALUATE method returns zero
 
Hi Rob,

<I take the contents of the bracket and put it into a cell then Excel calculates the correct answer

The way one refers to cells in a worksheet differs from how it's done in VBA.
What's your formula?

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Rob" wrote in message ...
|I have a UDF which uses EVALUATE ( )
|
| If I take the contents of the bracket and put it into a cell then Excel
| calculates the correct answer, but I get zero from Evaluate.
|
| The contents of the bracket is a SUMPRODUCT formula.
|
|



Rob

EVALUATE method returns zero
 
See below from the Imediate window. If I put the formula onto my sheet it
works, but I get the error when I try to evaluate the statement.


?"=SUMPRODUCT((Ex_Sales_Date=""" & SalesDate & """*1)*1,
(Ex_Sales_Yield1=""" & Yield_1 & """)*1,(Ex_Sales_Yield2=""" & Yield_2 &
""")*1,(Ex_Sales_Yield3=""" & Yield_3 & """)*1,Ex_Sales_Volume)"
=SUMPRODUCT((Ex_Sales_Date="27/01/2008"*1)*1,
(Ex_Sales_Yield1="")*1,(Ex_Sales_Yield2="")*1,(Ex_ Sales_Yield3="")*1,Ex_Sales_Volume)

?application.Evaluate("=SUMPRODUCT((Ex_Sales_Date= """ & SalesDate &
"""*1)*1, (Ex_Sales_Yield1=""" & Yield_1 & """)*1,(Ex_Sales_Yield2=""" &
Yield_2 & """)*1,(Ex_Sales_Yield3=""" & Yield_3 & """)*1,Ex_Sales_Volume)")
Error 2015


"Niek Otten" wrote:

Hi Rob,

<I take the contents of the bracket and put it into a cell then Excel calculates the correct answer

The way one refers to cells in a worksheet differs from how it's done in VBA.
What's your formula?

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Rob" wrote in message ...
|I have a UDF which uses EVALUATE ( )
|
| If I take the contents of the bracket and put it into a cell then Excel
| calculates the correct answer, but I get zero from Evaluate.
|
| The contents of the bracket is a SUMPRODUCT formula.
|
|





All times are GMT +1. The time now is 08:49 PM.

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