Numerical JCChemicalTerms are returned as text in Excel.

User fca09bdbff

02-09-2012 05:46:26


I have been calculating molecule properties in JChem/Excel using both JChemExcel.Functions e.g. JCAliphaticRingCount(A1), and Chemical Terms e.g. JCChemicalTerms(A1,"matchCount('n')").

It appears that the former method returns numerical values that Excel recognises as numbers, whereas the latter returns numerical values that Excel recognises as text.

Although it is possible to convert the text results into numbers in Excel, is there a way to return JCChemicalTerms values that are correctly perceived as numbers?


Tim Ritchie (GlaxoSmithKline UK).

ChemAxon bd13b5bd77

06-09-2012 15:31:45

Hi Tim,


I checked the COM interface that JChemExcel exposes for the Excel host, and the interface is okay. It returns and handles VARIANT (object) which can be any type theoretically.


The problem is that our underlying library returns not primitive types but reference types .NET does NOT handle them automatocally as primitve data types (like int <> java.lang.Integer). Which means that when it is auto converted the toString method is automatically called on these reference types.


The workaround you can use is to embed this into a cast function of Excel:





User fca09bdbff

06-09-2012 16:31:38

Thanks Viktor.

I had used the INT command in Excel to convert the 'string' calculation into a number, but I didn't realise that one can include this in the actual JC formula.