Nested Excel lopp

Need to use nested Excel loop.Can we do this.
I’m getting array index out of range exceptio for the second iteration.


Yes, nested excel loop can be used. Check the arguments that you are passing for array index out of range exception issue

Amit Anand

Hi Amit,

I have checked and all the arguments are correct.Looks like there is a defect in the Excel Loop Activity.

Scenario : 2 Excels are to compared.The value from 1st excel -Column A needs to be searched in 2nd Master Excel Column A.

Assume 1 st Excel has 2 Rows starting from Row 2.[Row 1 is the header] and 2nd Excel has 100 rows

Now here i am trying to use Nested Excel loop where the first Excel loop ,Column A ,Row 2 i.e A2 value is searched in the 2nd Excel loop .

Case 1 : Value to be searched from Excel 1 exists in sequence in Excel 2 - > Works fine
Case 2: Value to be searched in Excel 1 is not in sequence in Excel 2- > Does not work fine.[Defect]

E.g. - Excel 1 - Value in A1 exists in Excel 2 - A13 - OK
Excel 2- Value in A2 exists in Excel 2 - A5 - Gives Error [Array Index out of range]

My analysis - In the 2nd Excel Loop,the loop cntr doesn’t reset to zero and hence it works fine when searched sequentially and not when searched in non sequential manner.

Can you now please help me know what is the loop ctr variable which we can use to reset it before starting the search each time.I think this is a simple fix but since no code is visible to us,can’t do anything .

Please help as this is required for one of my critical task.


Your error has nothing to do with indices. The EXCEL LOOP use case requires that the spreadsheet not be empty …that is there should at least be a header + 1 row on the spreadsheet already. The loop iterates through existing rows. I know that it doesn’t quite make sense but just add a value on the first cell of the first row after the header and you will be in the clear.


Just to give an understanding Nested Excel Loop works in following manner for loop execution. Say i have OuterExcel which have 3 rows and inside that i use an Inner Excel which have 4 rows. Then loop execution will happen as shown in this screenshot