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. Image for the cookie policy date

Cell referenced in formula

Is there a way to find the cell or range that is referenced in a formula?

for instance, if my formula is '=Display!B17', I would like to be able to 'go to' or perform some change on the cell that is referenced in the formula, Grid display, cell B17.

I have looked through some of the methods in the formula engine, but I am not seeing anything that looks like the functionality I am looking for.

I can probably write a routine to parse it out, but I thought I would check to see if anyone has done it, or if the control itself has a way.

thanks,
M

3 Replies

JJ Jisha Joy Syncfusion Team June 12, 2009 11:33 AM UTC

Hi Melinda,

You can use the following code to achieve the desired behavior.

GridRangeInfo range = GridRangeInfo.Parse("B17");
int col = range.Top;

Please let me know if this helps.

Regards,
Jisha


MP Melinda Peirce June 12, 2009 01:40 PM UTC

Tried this, I get an "Invalid Range" exception on the GridRangeInfo.Parse("B12")

I guess i am wondering if there are methods in the formula engine that can get information about the cell(s) being referenced.. are they public or can they be made public? And, do any retrieve any information besides the value?

What I am trying to do is this: I am building a large workbook in a tab/grid. I am reading the data out of an existing excel workbook. Most of the workbook pages need to be read only and disabled. I have another page in the excel workbook that lists all of the cells that should be marked as enabled. I would like to list them in a format similar to the formula =Certification!B12:F12 (without the '=') Then, as I read through the list be able to set the style on each cell or range.

So, I need to be able to first find the correct sheet/grid, then change the appropriate cells on that grid.

Thoughts on a simple way to do this?
thanks,


RC Rajadurai C Syncfusion Team June 20, 2009 06:10 AM UTC

Hi Melinda,

Thanks for your interest in Syncfusion Products.

In GridFormulaEngine, there are two properties available through which we can retrieve formula dependencies for a cell.
1) GridFormulaEngine.DependentCells - Gets a mapping between a cell and a list of formula cells that depend on it.
2) GridFormulaEngine.DependentFormulaCells - Gets a mapping between a formula cell and a list of cells upon which it depends.

These properties maintain a collection of its own regarding cell dependencies.

Please refer to the following minimal sample in which the dependent cells of a cell can be retrieved and displayed on listbox placed in form while clicking on the formula cell.
http://files.syncfusion.com/support/samples/Grid.Windows/7.2.0.20/F82402.zip

Regards,
Rajadurai

Loader.
Live Chat Icon For mobile
Up arrow icon