Reputation: 11816
I have a function that returns an ODate (date in a double data type) from a called API.
Private Function CoreCompute(....)
....
CoreCompute = oXmlHttp.ResponseText //sample return: a double value 41902, which is equivalent to 2014/09/20
End Function
When this is called to a cell with a Format of Date, it is not transformed to a date value and not equal to a true date cell.
How can I output a value in a cell which can be compared to an actual date cell value?
PS. Q17 is actually Q16
Upvotes: 1
Views: 96
Reputation: 7303
Try CoreCompute = CDbl(Trim(oXmlHttp.ResponseText))
This probably works because your response is a string and it could have whitespace included.
Trim
will remove the whitespace
CDbl
will ensure that value is converted to a number type.
Upvotes: 1