+ Reply to Thread
Results 1 to 9 of 9

Add 1 in range B2:B2000 according to column C2:C2000

  1. #1
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,095

    Add 1 in range B2:B2000 according to column C2:C2000

    Hello
    i have data in range C2:C2000
    e.g
    c2 = a
    c3 = a
    c4 = a
    c5 = a
    c6 = b
    c7 = b
    c8 = c
    c9 = c
    c10 = c
    c11 = c
    c12 = d
    c13 = e
    c14 = f
    c15 = f
    .....
    c2000 = ?

    then i want
    B2 = 1
    B6 = 1
    B8 = 1
    B12 = 1
    B13 = 1
    B14 = 1

    put 1 according to column C2:C2000 where first word end then add a 1
    Last edited by HaroonSid; 05-15-2014 at 10:07 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Add 1 in range B2:B2000 according to column C2:C2000

    So you want to know when the contents changes?
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Add 1 in range B2:B2000 according to column C2:C2000

    =if(offset(A2,-1,0)<>a2,1,0)

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2509 Win 11
    Posts
    24,996

    Re: Add 1 in range B2:B2000 according to column C2:C2000

    In B2, type 1. In B3, type =if(C3=C2,"",1) and copy down.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,095

    Re: Add 1 in range B2:B2000 according to column C2:C2000

    yes nathansav

    when change the contents then put 1 on evry changing

  6. #6
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,095

    Re: Add 1 in range B2:B2000 according to column C2:C2000

    Hello mod alansidman
    there is one problem

    i want to create serial number till contents change

    e.g
    c2 = a
    c3 = a
    c4 = a
    c5 = a
    c6 = b
    c7 = b
    c8 = c
    c9 = c
    c10 = c
    c11 = c
    c12 = d
    c13 = e
    c14 = f
    c15 = f
    .....
    c2000 = ?

    then i want
    B2 = 1
    B3 = 2
    B4 = 3
    B5 = 4
    B6 = 1
    B7 = 2
    B8 = 1
    B9 = 2
    B10 =3
    B11 = 4
    B12 = 1
    B13 = 1
    B14 = 1
    B15 = 2

  7. #7
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Add 1 in range B2:B2000 according to column C2:C2000

    =if(offset(a2,-1,0)<>a2,1,offset(b2,-1,0)+1)

  8. #8
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,095

    Re: Add 1 in range B2:B2000 according to column C2:C2000

    Perfect

    absolutely perfect

    thanx nathansav

    will add reputation surely

  9. #9
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2509 Win 11
    Posts
    24,996

    Re: Add 1 in range B2:B2000 according to column C2:C2000

    Alternative solution.

    =if(C3=C2,B1+1,1)

    In the future, I urge you to explain your issue in full. You may see clearly what is in your worksheet and understand what you want. We can't see it or read your mind. If you don't communicate it clearly to the forum, then responses will be accordingly.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Sum column AB by date range in Column N and text in column X
    By richtree in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-05-2014, 12:04 PM
  2. [SOLVED] Define new range names based on existing range name offset 1 column to right
    By jprlimey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-03-2014, 07:53 PM
  3. Replies: 4
    Last Post: 07-19-2013, 04:35 AM
  4. [SOLVED] Cond. formatting a column/Range, highlight cell in column/range if equal to specific text
    By DFrank231 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-19-2013, 03:35 PM
  5. Macro broken - copy data range column to empty data range column
    By Cascus in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-06-2011, 05:20 PM

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