Increment Cell by one: 2 conditions

Irish Guy

New Member
Joined
Jul 16, 2013
Messages
4
I am looking to increment Column A by one, if the corresponding cell in Column B has text.

It gets tricky as shown in the picture attached / linked at row 9 and 10. B9 and B10 have no text, so A9 and A10 are not incremented.

The next column with text is B11, so that value in A11 is 9.

I should clarify that all cells in Column B have formulas, even the blank ones.

Is there a formula that could do this automatically?

Thanks guys.


excel condition by Irish_Guy2012, on Flickr

http://farm6.staticflickr.com/5442/9298869397_39f53f5f31_o.png
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I am looking to increment Column A by one, if the corresponding cell in Column B has text.

It gets tricky as shown in the picture attached / linked at row 9 and 10. B9 and B10 have no text, so A9 and A10 are not incremented.

The next column with text is B11, so that value in A11 is 9.

I should clarify that all cells in Column B have formulas, even the blank ones.

Is there a formula that could do this automatically?

Thanks guys.


excel condition by Irish_Guy2012, on Flickr

http://farm6.staticflickr.com/5442/9298869397_39f53f5f31_o.png
Try this... put a 1 in A1 and then put this formula in A2 and copy it down...

=IF(B2="","",1+LOOKUP(999999,A$1:A1))
 
Upvote 0
In A1 and copy down:
=IF(B1="","",COUNTA(B$1:B1))
 
Upvote 0
Try this... put a 1 in A1 and then put this formula in A2 and copy it down...

=IF(B2="","",1+LOOKUP(999999,A$1:A1))

Would it possible to have a zero in the blank cells?

The reason I asked is that in another cell, a formula links to these cells and carries out a sum. Because the cell is blank it displays #VALUE! which disrupts other formulas.

If there was a way of deleting this, or having a zero in the blank cells it would be great:confused:
 
Last edited:
Upvote 0
Would it possible to have a zero in the blank cells?

The reason I asked is that in another cell, a formula links to these cells and carries out a sum. Because the cell is blank it displays #VALUE! which disrupts other formulas.

If there was a way of deleting this, or having a zero in the blank cells it would be great:confused:

Ah, I figured it out...

=IF(ISERROR(N10/M10),"",N10/M10)
 
Upvote 0
Would it possible to have a zero in the blank cells?

The reason I asked is that in another cell, a formula links to these cells and carries out a sum. Because the cell is blank it displays #VALUE! which disrupts other formulas.
Just change my formula to output 0 instead of "" when the cell in Column B is empty...

=IF(B2="",0,1+LOOKUP(1000000,A$1:A1))
 
Upvote 0

Forum statistics

Threads
1,215,368
Messages
6,124,521
Members
449,169
Latest member
mm424

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top