If I have the following general excel columns, how could a create a program or loop in which I can generate what I have in column A and Column B as lists. "i" represents row number so that for instance in Column A and row 3 I will have 0+0.001 (0.001=step size) and in row 4 of the same column I would have what I got in row 3 plus step size and so on. The same goes for Column B, but notice that in this case "q" changes, so I would like to generate the column B for each q as well.

I think this is pretty much a very easy standard question but I am fairly new to mathematica and I would appreciate your help.

Edit: Please also notice that I do not want to import the values of column A and B but rather have a code that calculates them.


  • $\begingroup$ Check Import and give an option "Table". $\endgroup$ – Alexei Boulbitch Apr 28 at 18:21
  • $\begingroup$ Thank you!. I am aware of both functions. My problem is not doing the import. What I want is to have a code that can get what I have in both columns (not to import them) by means of a loop or something like that. In other words, I want to have the same numbers I have in those columns but generate them myself with a code having both A and B columns as lists $\endgroup$ – John Apr 28 at 18:28
  • $\begingroup$ Column B isn't well defined, Cell B2 is a scalar, cell B3 is a list,.... What is the meaning of "q *(i row,columnA)" . It might help if you would examplary show the content of the first cells B3, B4,... $\endgroup$ – Ulrich Neumann Apr 28 at 19:15
  • $\begingroup$ Ulrich Column B starts with the value 90 and then row 3 would be 90+number+q, where number is 3 and q is a list with the first value being 0.1. In row 3, it would be what I got in row 3 plus number-q. I hope that helps clarify it. $\endgroup$ – John Apr 28 at 19:27
  • $\begingroup$ Again my question: For every value of q, say qi, you want an individual column B[qi]? $\endgroup$ – Ulrich Neumann Apr 28 at 19:46

Try recursive function RSolveValue

colA = RSolveValue[{a[n] == a[n - 1] + stepsize, a[0] == 0}, a, n];
colA[Range[0, 100]]
(*{0., 0.001, 0.002, 0.003,.., 0.1}*)

Same for column B:

colB[qi_] :=RSolveValue[{b[n] == b[n - 1] + number - qi , b[0] == 90}, b, n];
colB[.1][Range[0, 100]] (* q=0.1 *) 
| improve this answer | |
  • $\begingroup$ Thank you very much Ulrich!. This is great. One quick question. If I want to multiply qi by the i element of column A, how could I do that in this code?. $\endgroup$ – John Apr 28 at 20:24
  • $\begingroup$ Perhaps qi n stepsize $\endgroup$ – Ulrich Neumann Apr 28 at 21:07
  • $\begingroup$ That does not seem to work. I want to multiply say the qi that I get from row 2 by the number I get in Column A and row 2, qi of row 3 by the number I get in Column A and row 3 and so on....I am not sure how to do this part as well. $\endgroup$ – John Apr 28 at 21:12
  • $\begingroup$ I guess this could be similar to having something like as an exmaple: variable={5,6,7,8,9,40,30,80..etc.} and simply multiply each row of qi by each element of variable. Is it possible to have a list with elements that can be obtain for each iteration in this code? $\endgroup$ – John Apr 28 at 21:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.