Home > Software engineering >  How to repeat a App script function for only certain column
How to repeat a App script function for only certain column

Time:11-18

I have written this JS function in google sheet

=calculateCallLoss(D3, D2:D65, B2:B65, A2:A65)

Now I want to repeat this function in a column but only first param should increment e.g in next row it should be like

=calculateCallLoss(D4, D2:D65, B2:B65, A2:A65)

If I try to copy-paste and repeat it then other params are touched as well which should remain constant in every row.

Can you please share how to achieve this?

CodePudding user response:

In your situation, how about the following modification? In this modification,

Modified formula:

=calculateCallLoss(D3, $D$2:$D$65, $B$2:$B$65, $A$2:$A$65)

or

=calculateCallLoss(D3, INDIRECT("D2:D65"), INDIRECT("B2:B65"), INDIRECT("A2:A65"))

or

=BYROW(D3:D,LAMBDA(ROW, calculateCallLoss(ROW, D2:D65, B2:B65, A2:A65)))
  • In this case, please put this into a cell. By this, D3:D is used.

Note:

  • Although I'm not sure about your actual script of calculateCallLoss, I thought that in your situation, your goal might be able to be achieved by modifying your current script.
  • Related