If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Auto Number Formula?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-29-07, 09:59
X-Centric X-Centric is offline
Registered User
 
Join Date: May 2004
Posts: 73
Question Auto Number Formula?

I have a spreadsheet that needs to be numbered automatically. However, I need it numbered based on cells in the next column. For instance:

1 Apples
1 Apples
1 Apples
2 Oranges
2 Oranges
3 Pears
3 Pears
3 Pears
3 Pears
4 Plums
5 Mangos

I know it's an IF statement but I can't see the wood for the trees.
Reply With Quote
  #2 (permalink)  
Old 04-29-07, 15:21
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Code:
if(B1 = B2, A1, A1 + 1)
Does that do what you want?
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 04-29-07, 22:53
X-Centric X-Centric is offline
Registered User
 
Join Date: May 2004
Posts: 73
It doesnt work. I get a circular reference error. Thank you for trying.

Last edited by X-Centric; 04-29-07 at 23:17.
Reply With Quote
  #4 (permalink)  
Old 04-30-07, 07:17
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Quote:
colA | colB
1 | Apples
2 | Apples B2 = B1
3 | Apples B3 = B2
4 | Oranges B4 <> B3 +1
5 | Oranges B5 = B4
6 | Pears B6 <> B5 +1
7 | Pears B7 = B6
8 | Pears B8 = B7
9 | Pears B9 = B8
10 | Plums B10 <> B9 +1
11 | Mangos B11 <> B10 +1
Code:
if(B2 = B1, A1, A1 + 1)
Try the above, small change + the logic behind my suggestion
__________________
George
Twitter | Blog
Reply With Quote
  #5 (permalink)  
Old 04-30-07, 07:47
X-Centric X-Centric is offline
Registered User
 
Join Date: May 2004
Posts: 73
It worked. Thank you for you help. I appreciate it very much.
Reply With Quote
  #6 (permalink)  
Old 04-30-07, 07:49
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
You're very welcome.
I would like to point out that this will only be "accurate" if your column is sorted appropriately.
Quote:
1 Apples
1 Apples
1 Apples
2 Oranges
2 Oranges
3 Pears
3 Pears
3 Pears
3 Pears
4 Plums
5 Mangos
6 Apples
7 Pears
__________________
George
Twitter | Blog
Reply With Quote
  #7 (permalink)  
Old 04-30-07, 13:28
X-Centric X-Centric is offline
Registered User
 
Join Date: May 2004
Posts: 73
Got it.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On