Jump to content
Sign in to follow this  
DJ143

find the row number of excel sheets with two particular column values

Recommended Posts

DJ143

I have a sheet it has 5 columns and more than 1000 rows. I have to identify a row by its 1st and 5th column and get the values of 2,3 and 4 column values in that particular row. I have used For loop but this is taking more time for identifying the row. Please help in resolving this problem.

Share this post


Link to post
Share on other sites
JLogan3o13

You have very nicely defined what you want, however you have not shown what you have tried to accomplish on your own. Please start with looking at the Excel functions in the help file. There are a couple of ways you could tackle the problem. For the simplest, try something like this:

   Look at _Excel_Open() and _Excel_BookOpen() to open the workbook in question. 

   Look at _Excel_RangeRead, read the range into an array and then parse through the array looking for your values.

 I'll leave you to tweak this to your needs...

;psuedo

_excel_open
_excel_bookopen(<path to book>)
$aRange = _excel_rangeread(workbook, worksheet, range)
    For $i = 0 to ubound($arange) - 1
        If $arange column 1 = x and $arange column 5 = y Then
           return $arange columns 2, 3 and 4
        EndIf
    Next

 


√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
DJ143

hi.. that was very helpful.. with arrays it could find in less time than before. performance got increase. thank you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×