View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
[email protected] Internetdomainowner@hotmail.com is offline
external usenet poster
 
Posts: 32
Default AutoIncrementing a Column like a database in Excel 2007

On Jul 24, 6:21*pm, keith wrote:
Hi,
* We're going to use an SQLite database but we'd like to do all our data
entry in excel. Then we'd like to save the sheets as .csv files and import
the data into an SQLite database. For us to do this successfully we need to
be able to AutoIncrement an id field in Excel like a database would. Does
anyone know the best way to do this?

Thanks,
* *Keith


Try this...

Use Range A1 as your starting posistion and enter the following
formula...
=IF(LEN(B1)=0, "", 1)

In Range A2 and the rest of the other cells...
=IF(LEN(B2)=0, "", SUM(A1+1))

Copy the formula from Range A2 and paste all the way down the bottom
of the sheet... when you export the file out it will come out clean
like a database with an Access style primary key.