)
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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use VLOOKUP formula in WinForms GridControl?

Platform: WinForms |
Control: GridControl |
Published Date: April 29, 2016 |
Last Revised Date: December 16, 2019
Tags: formula

VLookup formula

To use VLOOKUP formula by assigning the CellType property as “FormulaCell” to the specified grid cells. Refer the below code to enable the formula cell and the syntax for using the VLOOKUP formula.

C#:

// Sets the entire Grid cells as FormulaCell.
this.gridControl1.BaseStylesMap["Standard"].StyleInfo.CellType = GridCellTypeName.FormulaCell;
// Sets the specific cell as FormulaCell.
this.gridControl1[5, 5].CellType = GridCellTypeName.FormulaCell;
// Sets the specific row as FormulaCell.
this.gridControl1.Model.RowStyles[7].CellType = GridCellTypeName.FormulaCell;
// Sets the specific column as FormulaCell.
this.gridControl1.Model.ColStyles[4].CellType = GridCellTypeName.FormulaCell;

 

VB:

' Sets the entire Grid cells as FormulaCell.
Me.gridControl1.BaseStylesMap("Standard").StyleInfo.CellType = GridCellTypeName.FormulaCell
' Sets the specific cell as FormulaCell.
Me.gridControl1(5, 5).CellType = GridCellTypeName.FormulaCell
' Sets the specific row as FormulaCell.
Me.gridControl1.Model.RowStyles(7).CellType = GridCellTypeName.FormulaCell
' Sets the specific column as FormulaCell.
Me.gridControl1.Model.ColStyles(4).CellType = GridCellTypeName.FormulaCell
 

 

CellValue can be assigned by using VLOOKUP formula and the syntax for the VLOOKUP is,
VLOOKUP(lookup_value,table_array,row_index_num,range_lookup)

C#:

// The value "Data3" is looked up in the grid.
this.gridControl1[2, 4].CellValue = "=vlookup(\"Data3\",A1:C4,3,false)";

 

VB:

' The value "Data3" is looked up in the grid.
Me.gridControl1(2, 4).CellValue = "=vlookup(""Data3"",A1:C4,3,false)"

 

 

Show the VLoopkup formula in grid

Samples:

C#: VLOOKUP

VB: VLOOKUP

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

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

Live Chat Icon For mobile
Live Chat Icon