# How to calculate a dynamic variable

How to calculate the value of a variable that takes the value of a cell in a excel sheet that will change according to an increment loop

I’m starting with i and j as 0
and using these formulas
`num_folio=contenido_archivo_folios["Hoja1"] + i + ["Folio"]`
`nom_aseguradora=contenido_archivo_folios["Hoja1"] + j + ["Folio"]`

but when i run the workflow the values it returns are:

@Yoshi I could see that the variables declared for loop i and j are initialized with string 0 not a number. Could you please change the initialization like below.

Let me know if it works!

Thanks for the note
I change the initialization but still not working

@Yoshi I think some logic is missing, with formulae or i might not getting why you are using two loop.

As per this formula num_folio=contenido_archivo_folios[“Hoja1”] + i + [“Folio”]
you want to increment the value of Folio with i. Is this correct?
If yes, then use formula like this, num_folio=contenido_archivo_folios[“Hoja1”][i] [“Folio”] +i

Let me know if it works for you!

I changed the formula of num_folio to =contenido_archivo_folios[“Sheet1”][i][“Folio”] and of nom_aseguradora by contenido_archivo_folios[“Sheet1”][j][“Aseguradora”] and the value it assigns to them is correct. Thanks

Now I need to increment the value of i and j so in the next loop will extract the value from the next position in the column

I found my mistake.
I was repeating the loop at the wrong step, before assigning the initial values ​​of i and j, instead of before the comparison .

It has been solved, thank you very much for your support