Autopopulate row number in A2 IF data is entered in B2.

C

Cassie

How can I autopululate a row number in a cell A* ONLY if there is data is
entered in B*? I tried an =IF(b2= " ",then "2") in the cell I want the
number to appear and that did not work.
 
J

JLatham

Close! But not quite there. Try
=IF(B2="",2,"")
you don't need the word "then" in there, the format for the IF() is
IF(test condition, true action, false action)
 
R

RagDyeR

Your formula attempt *doesn't* match your description and subject line.

Try this in A2, and copy down as needed:

=If(B2<>"",Row(),"")

--

HTH,

RD
=====================================================
Please keep all correspondence within the Group, so all may benefit!
=====================================================

How can I autopululate a row number in a cell A* ONLY if there is data is
entered in B*? I tried an =IF(b2= " ",then "2") in the cell I want the
number to appear and that did not work.
 
C

Cassie

OK- I guess I said that backwards. I only want the numbering if there is
data in cell b2. How does that change the formula? Would it be =IF(B2
isnotblank,2,"")
 
C

Cassie

Thanks. This works except for one thing. When I copied this into row 3
(which is actualy the 2nd row of data) it entered the row number as 3. How
can I do this but have it show 2 instead of 3?
 
R

RagDyeR

Use the Rows() function instead:

Copy down to increment, same as Row(),

Start where you wish:
Rows($1:2) starts at 2
Rows($1:3) starts at 3
Rows($1:4) starts at 4
.... etc.
--

HTH,

RD
=====================================================
Please keep all correspondence within the Group, so all may benefit!
=====================================================


Thanks. This works except for one thing. When I copied this into row 3
(which is actualy the 2nd row of data) it entered the row number as 3. How
can I do this but have it show 2 instead of 3?
 
D

David Biddulph

If you have a formula that returns 3 and you want 2, and similarly in other
rows you wish to return a value reduced by 1, then perhaps subtracting 1
would be a useful extra feature to include in your formula?
 
J

JLatham

for my part of it, change
(B2="",
to
(B2<>"",

I think RagDyeR has given you the rest of it.
 
Top