We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Countif function doesn't parse

Thread ID:

Created:

Updated:

Platform:

Replies:

121614 Jan 7,2016 02:46 PM UTC Jan 22,2016 12:36 PM UTC WinForms 5
loading
Tags: Calculate
Carron Schilders
Asked On January 7, 2016 02:46 PM UTC

Hi,

I'm working with the CalcQuickBase object, it works fine, but I'm currently having a hard time parsing the CountIf function
I'm very new to the Calculate object.

example Code :

var cq=new CalcQuickBase();

var checkValue=">1407";

cq["A"]="1407";
cq["B"]="1408";
cq["C"]="1407";
cq["result"]=cq.ParseAndCompute(" = CountIf ( ( A , B , C ) , checkValue )");

I also tried " = CountIf ( ( A , B , C ) ,\">1407\")"

This doen't work. Probably I'm doing something wrong when specifying my list.

I tried also this one:

var engine=cq.Engine;
engine.AddNamedRange("A","1407");
engine.AddNamedRange("B","1408");
engine.AddNamedRange("C","1407");

var result=engine.ParseAndComputeFormula("= CountIf ( ( A , B , C ) , checkValue )");

but no success

On the other hand the Count works fine:
var result=engine.ParseAndComputeFormula("= CountIf ( A , B , C )");

Can you point me into the right direction with this?

Mahendran Annamalai [Syncfusion]
Replied On January 8, 2016 01:35 PM UTC

Hi Carron,

Thanks for using Syncfusion products.

By default, the values from the particular key in CalcQuick are returned as an object value. This value can be converted to a string using ToString() method. As separate support is not provided to format the result of the CalcQuickthe result is formatted using int.Parse, double.Parse and decimal.Parse. Refer the below code example.

CalcQuick calculator = new CalcQuick();

//Reassigning the formula if changed

calculator["A"] = this.value1Text.Text;

calculator["B"] = this.value2Text.Text;

calculator["C"] = this.formulaText.Text;            


//Used to recalculate the all formulas in CalcQuick

calculator.SetDirty();


//Formatting the result string after parsed as double

this.resultText.Text = double.Parse(calculator["C"].ToString()).ToString("#,##0.00");





please refer the below KB Link and UG Link to know more about CalcQuick:

KB : https://www.syncfusion.com/kb/5135/how-to-format-the-result-of-the-calcquick-calculations


UG: http://help.syncfusion.com/windowsforms/calculate/faq/calcquick/how-to-calculate-a-formula



Regards,

Mahendran.A


Carron Schilders
Replied On January 9, 2016 06:41 PM UTC

Hi,

Thanks for your quick response. It's probably me, but how does this relate to my question about the Countif?
I really can't get it to work. In your code example you don't use the ParseAndCompute method. i tried that but with no luck.

I'm having trouble in how to use the countif with the CalcQuickBase object.

Do you have an example with CountIf and calcQuickBase for me?

With kind regards,

Carron


Mahendran Annamalai [Syncfusion]
Replied On January 11, 2016 02:35 PM UTC

Hi Carron,

Thanks for your update.

As we have checked with excel and calcquickbase source, we can’t able to calculate the Countif formula as like you  CountIf ( ( A , B , C ) , checkValue )" mentioned. See reference link below.

Linnk : https://support.office.com/en-us/article/COUNTIF-function-e0de10c6-f885-4e71-abb4-1f464816df34

 We need to add additional control like grid then only so that we can set required values in cell and pass this cell range as argument. We have provided sample for this by using calcEngine in dashboard. Please refer the sample location.

Sample Link : C:\Users\.................. \AppData\Local\Syncfusion\EssentialStudio\..........\Windows\Calculate.Windows\Samples\Data Grid Calculator Demo\CS.

Please let us know if you need any further assistance on this.

Regards,
Mahedran.A

Carron Schilders
Replied On January 21, 2016 03:39 PM UTC

Hi Mahendran,

I've attached a zip file with two screenshots in it taken from the DataGrid Calculation Demo CS
sample. As you can see I get an error (#NAME?) when I use the simple CountIf function.

I can't get it to work.

With kind regards,

Carron


Attachment: CountIf_db97e6d1.zip

Jagadeesan Pichaimuthu [Syncfusion]
Replied On January 22, 2016 12:36 PM UTC

Hi Carron,

Thanks for the update.

We had analyzed the issue with “CountIf function does not parse” in the Dashboard sample. You can solve the CountIf parse problem by using the formula like “=CountIf(A1:A7,">5")”.  Please find the screenshot with Syncfusion control and MS Excel.

Attachment:
http://www.syncfusion.com/downloads/support/forum/121614/ze/ScreenShots1489449229

Please let us know if you need any further assistance on this.

Regards

Jagadeesan

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;