+ Reply to Thread
Results 1 to 5 of 5

Data validation - Cell to increment by 1

Hybrid View

  1. #1
    Registered User
    Join Date
    12-30-2007
    Posts
    3

    Data validation - Cell to increment by 1

    hi guys,
    I know this is probably very simple, but I have been trying for hours to no avail..

    Basically, I have a column header named invoice number at the top of column B (B1)

    This column then contains incrementing numbers, with some blank cells inbetween

    i.e.

    B2 :- 467
    B3 :- 468
    B4 :- empty
    B5:- 469
    B6 :- empty
    B7 :-
    .
    .
    .
    .
    .



    Basically, I would type 470 in cell B7 in order to continue the series, however, I would like some validation to take place on the cells in this coliumn to only allow a number which is 1 more than the last non empty field, ..i.e in this example it would only allow the user to enter 470 in B7 (by referencing the contents of the last non empty field; B5 (469) and adding 1 to it... (if any other number other than 470 (in this example) was entered, it would report an error)

    Im sure this can be done with some conditional forumula? any help would be greatly appreciated...

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Select Cell B2 down as far as you need > Select Data > validation > custom and enter
    =B2=MAX($B$1:B1)+1
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    12-30-2007
    Posts
    3
    many thanks mate works a treat

    what is that forumla translated into english?

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    If you look at B7 the formula changes as B1 is absolute and the second ref isn't

    http://www.bettersolutions.com/excel...C418316331.htm

    =B7=MAX($B$1:B6)+1
    So it checks that B7 = max value in Range B1 to B6 which will be 469 + 1 (470)

    VBA Noob

  5. #5
    all4excel
    Guest

    Smile I can provide u very small code which I use myslef or getting a Sr.no

    I can provide u very small code which I use myself or getting a Sr.No.

    If you want the serial no in column A and have the data starting from column B..
    Example ...
    Col A Col B
    Sr.No. Employee ID..

    Just type = [ IF(ISBLANK(B2),"",COUNTA($B$2:B2)) ]..

    You will get a serial number whenver u type an Employee ID in the column B contiguous/non-contiguous manner displayed in Column A..
    Last edited by all4excel; 12-31-2007 at 03:48 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1