Increment a counter in Excel
How can I increment a counter in a worksheet cell from the value entered in
other cellsl? For instance if the value in cell A2 = true I want to replace the value in B2 with the value in A1(the counter), then increment the value in A1 by 1. The worksheet might look like this: A B 1 4 2 TRUE 1 3 FALSE 4 TRUE 2 5 TRUE 3 6 7 |
Try this:
1. Copy this into A1: =COUNT(B:B) 2. Copy this into B2 and fill down the column as far as you think you'll need it: =IF(A2="","",IF(A2,MAX($B$1:B1)+1,"")) 3. Star filling in col. B with TRUE/FALSE HTH Jason Atlanta, GA -----Original Message----- How can I increment a counter in a worksheet cell from the value entered in other cellsl? For instance if the value in cell A2 = true I want to replace the value in B2 with the value in A1(the counter), then increment the value in A1 by 1. The worksheet might look like this: A B 1 4 2 TRUE 1 3 FALSE 4 TRUE 2 5 TRUE 3 6 7 . |
Thanks, Jason. This is almost it! I also need to increment the counter in
A1 (which will actually be on another spreadsheet. Each sheet will use the counter on sheet!A1. I am assigning a number to each "true" which could be on multiple sheets. Also, I think you meant for your #3. instruction to be "Start filling in col. A" rather than col. B???? This is what my spread sheet looks like now: A B 1 0 2 TRUE 1 3 TRUE 2 4 TRUE 3 5 TRUE 4 6 TRUE 5 7 TRUE 6 8 TRUE 7 9 FALSE 10 TRUE 8 11 FALSE 12 TRUE 9 13 FALSE "Jason Morin" wrote: Try this: 1. Copy this into A1: =COUNT(B:B) 2. Copy this into B2 and fill down the column as far as you think you'll need it: =IF(A2="","",IF(A2,MAX($B$1:B1)+1,"")) 3. Star filling in col. B with TRUE/FALSE HTH Jason Atlanta, GA -----Original Message----- How can I increment a counter in a worksheet cell from the value entered in other cellsl? For instance if the value in cell A2 = true I want to replace the value in B2 with the value in A1(the counter), then increment the value in A1 by 1. The worksheet might look like this: A B 1 4 2 TRUE 1 3 FALSE 4 TRUE 2 5 TRUE 3 6 7 . |
All times are GMT +1. The time now is 08:07 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com