# Thread: Add number to cell based on another cell's value Thanks: 0 Likes: 0

1. ## Add number to cell based on another cell's value

I am trying to find a way to insert a number in Column B (Person_ID) based on Cell Column G that is Blank. Then repeat the number in Column B until reach the next blank cell in Column G. Add 1 to number and repeat, thus giving each soldier an ID number. This would Loop to the end of worksheet. There are 27,000+ rows in spreadsheet. Below Ezekiel Able would be 1 in worksheet and next soldier would be 2 and so on.

Any help would be greatly appreciated.

2. ## Re: Add number to cell based on another cell's value

How about in B2 copied down
=COUNTIF(G\$2:G2,"")

3. ## Re: Add number to cell based on another cell's value

Hello,

In cell B3, you can try =IF(AND(C3=C2,D3=D2),B2+1,B3)

Hope this will help

4. ## Re: Add number to cell based on another cell's value

thanks for the info. But I am trying to get this through 27,000 rows with number changing based on another cell's value (empty)

5. ## Re: Add number to cell based on another cell's value

Did you try either of the solutions offered?
If so did they work? If not, in what way did they not work?

6. ## Re: Add number to cell based on another cell's value

Tried James suggestion. It places 1 in cell B4. I would like to give each person a id number. Ezekiel Able would have a 1 for in column B for each row associated with his name, John Adams would be 2, etc. Sorry for not making this clear in the original post.

7. ## Re: Add number to cell based on another cell's value

Did you try my suggestion?

8. ## Re: Add number to cell based on another cell's value

Originally Posted by gzell
Tried James suggestion. It places 1 in cell B4. I would like to give each person a id number. Ezekiel Able would have a 1 for in column B for each row associated with his name, John Adams would be 2, etc. Sorry for not making this clear in the original post.
Tested with your sample data... looks like it does generate your expected results ...

9. ## Re: Add number to cell based on another cell's value

@James006
With your formula I get the numbers 1 to 23 in B3:B25 & then nothing but 1s thereafter.
That's not to mention the circular references error.

10. ## Re: Add number to cell based on another cell's value

yes, I tried it. works as expected. thanks. I am trying to find a solution that will number all rows for each individual. Thank you for the response.