Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EPPlus & Data Comparison

Tags:

c#

excel

epplus

I am running a C# project with EPPlus libraries , I need it to check cells for data in various columns/rows and then find "keywords" so to speak and match it to data found in other various columns/rows.

I need to know a method for comparing data in a cell with data from another cell and finding a match.

The user selects an excel workbook & sheet through the gui , then runs this

Loop for checking cell data.

Variables.rowCount = Variables.worksheet.Dimension.End.Row;

for (i = 1; i <= Variables.rowCount; i++)
{
    Variables.cellValue = Variables.worksheet.Cells[i, 1].Text;
    Variables.cellValue1 = Variables.worksheet1.Cells[i, 1].Text;
    //...

Essentially I need it to do what Excel does when you select a filter and choose contains "word".

I hope I have explained this correctly.

like image 345
Allen Simpson Avatar asked Apr 30 '26 13:04

Allen Simpson


1 Answers

have a look at this example:

if (worksheet.Cells[i, 1].Value.ToString().Contains("word"))

this gets the value of the cell and compares it with the search string

like image 185
Kᴀτᴢ Avatar answered May 02 '26 02:05

Kᴀτᴢ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!