+ Reply to Thread
Results 1 to 4 of 4

Add value to Column F for each unique value in Column B, where Column C (next row) = 0

  1. #1
    Registered User
    Join Date
    06-19-2014
    Location
    Holland
    MS-Off Ver
    2010
    Posts
    1

    Question Add value to Column F for each unique value in Column B, where Column C (next row) = 0

    So my Excel sheet looks like this:

    A......B......C......D......E......F
    x......1......1......x......x
    x......1......1......x......x
    x......1......1......53....x
    x......1......1......x......x
    x......1......1......x......x
    x......1......1......99...x
    x......1......0......45....x
    x......1......0......x......x
    x......1......0......x......x
    x......2......1......x......x
    x......2......1......x......x
    x......2......1......x......x
    x......2......1......4.....x
    x......2......0......x......x
    x......3......1......x......x
    x......3......1......66...x
    x......3......0......x......x
    x......3......0......x......x
    x......3......0......463...x
    x......3......0......x......x
    x......4......1.....222..x
    x......4......0......x......x
    x......4......0......x......x
    x......4......0......x......x
    x......5......1......x......x
    x......5......1......x......x
    x......5......1......x.....x
    x......5......0......x......x
    x......5......0......x......x
    x......6......1......x......x

    etc...


    Basically, i need a script to add a '1' or "YES" to column F (empty now), in each row which is marked BOLD.

    So we are selecting each row with a unique COLUMN B value, but the last one of its kind which has COLUMN C = '1' (before the first '0' turns up).

    Selection of rows in which F has to be marked are:

    A......B......C......D.........E........F
    x......1......1......99........x......"YES"
    x......2......1......4..........x......"YES"
    x......3......1......66........x......"YES"
    x......4......1......222.......x......"YES"
    x......5......1......x..........x......"YES"

    etc...

    Kind of nasty to explain, appreaciate if someone can help. It is a worksheet with over 900.000 records.

    Regards blvdnights

  2. #2
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Add value to Column F for each unique value in Column B, where Column C (next row) = 0

    Hi
    Paste this code into a module in your workbook and it should do the trick. This assumes your data is in columns A to E and the result will be populated in column F.
    Please Login or Register  to view this content.
    Good luck.
    Tony

  3. #3
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Add value to Column F for each unique value in Column B, where Column C (next row) = 0

    hi blvd nights, welcome to ExcelForum, option to make it basing on the data sample provided, please check attachment, press Run button or run code "test"
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Add value to Column F for each unique value in Column B, where Column C (next row) = 0

    Maybe:

    Please Login or Register  to view this content.

+ 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] Macro to copy and paste only unique values from one column to another column in same sheet
    By Manish_Gupta in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-19-2014, 05:44 AM
  2. [SOLVED] Filter rows based on unique values in one column + specific value in another column
    By Dieneces in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-31-2013, 09:55 AM
  3. Replies: 8
    Last Post: 05-15-2013, 04:50 PM
  4. [SOLVED] Macro to count unique values in a column, enter it in next column, then delete duplicates
    By pmorisse in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-25-2013, 03:27 PM
  5. [SOLVED] Unique Alphanumeric number increament in column B when data in column E is entered
    By Bharathi27 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-10-2013, 12:12 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