Home > database >  Is there any scope to increment digit in excel?
Is there any scope to increment digit in excel?

Time:02-13

I have created a UDF in excel. Here is the function with cell reference as arguments:

=getInfo($A$3,B2,3)

In the above arguments, "3" is actually the row number which will be used for a calculation. Now if I drag this UDF over rows, the B2 is incremented as it is a cell reference (Range) but 3 is not incremented as it is a digit only. I need to use this third argument sometimes fixed (which is actually works in current condition), but sometimes I need to increment this argument while dragging.

My query is, is there any scope/option to increment the only digit in UDF without passing an additional optional argument for increment (eg: 3 1 or let's say I put 3 in any cell and use that cell to increment it by 1 for every row dragging)?

CodePudding user response:

You can use Row() function. Try-

=getInfo($A$3,B2,Row(A3))

When you drag it to 1 cell down then formula will =getInfo($A$3,B3,Row(A4)) means row argument 4.

  • Related