Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Increment constant in Excel Formula

Suppose, in Excel, I have a formula =$C$8+1, what must I add to the 1 such that when I drag, it becomes $C$8+2?

Can this be done?

Below is my actual formula.. I wish to increment 1 to 2 such that it becomes =2

IF((NOW()-$C8)=1,"1","0")
like image 434
Kyle Avatar asked Aug 01 '11 16:08

Kyle


People also ask

How do I increment a cell in Excel?

For example, incrementing 2 to 10 by the number 2 would be 2, 4, 6, 8, 10. 2. An increment is also a programming operator to increase the value of a numerical value. In Perl, a variable can be incremented by one by adding a ++ at the end of the variable.

How do I increase a value by 10 in Excel?

1. Enter the base value in a blank cell which you'll use to increase the value of existing cells. As an example, to add 10 to each cell, enter "10" (without the quotation marks here and throughout).


1 Answers

Well.. there might be several ways to do it, but the only one I have in the top of my head is using the =ROW() function.

Let's say you're starting the formula at row 5.

=IF((NOW()-$C8)=ROW()-4,"1","0")

The =ROW() will return the row number you currently are (i.e. 5, in this case). Thus, in the first row we'll have =1 (from 5-4) and then =2 (6-4) and so on.

Still, it seems you're comparing dates, right? I'd say you'd need to truncate the values to have a day comparison between them...

=IF((TRUNC(NOW())-TRUNC($C8))=ROW()-4,"1","0")

Hope it helps... or at least give you a path to chose your solution.

like image 55
Tiago Cardoso Avatar answered Oct 01 '22 23:10

Tiago Cardoso