+ Reply to Thread
Results 1 to 6 of 6

How to autofill a column depending on data in another column

  1. #1
    Registered User
    Join Date
    11-06-2021
    Location
    Belgium
    MS-Off Ver
    2016
    Posts
    3

    How to autofill a column depending on data in another column

    Hello,

    I have 2 columns of data (only 1's and 0's).
    When column A is "on" I would like it show the number 1 (and column B to display 0), and that until that number 1 appears in column B. From that point, column B is "on" and should display the number 1.

    Please see the image and example worksheet attached.
    I have tried several options, but none have worked so far (I am not proficient in excel). Presumably (or hopefully) there may be some easy trick or formula that can manage this.

    Image columns.JPG


    Thanks in advance for any help!

    Sam,
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,930

    Re: How to autofill a column depending on data in another column

    Are you saying that what you have in column A is fixed/static? And that what appears in column B is the opposite 0 -> 1, 1 -> 0? Or are you saying you also have some (wrong) static values in column B.

    If only column A is fixed, you could have a formula in column B to reverse the values.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    For scenario 2, you would probably need VBA To convert the values in column B … or a Helper column that operates in the same way as scenario 1.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,523

    Re: How to autofill a column depending on data in another column

    To reverse values

    =IF(A3,0,1)
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  4. #4
    Registered User
    Join Date
    11-06-2021
    Location
    Belgium
    MS-Off Ver
    2016
    Posts
    3

    Re: How to autofill a column depending on data in another column

    Thank you for your reply.

    What I am trying to accomplish is more like scenario 2.

    It would be some sort of "until" function or loop.

    Column A should have the number 1, until that number appears in column B; and then the number 1 should appear in column B until again it appears in Column A, and so forth.

    It is essentially like pushing two buttons.
    If I push button A for 5 seconds, I would have 5 hits of the number "1" (in column A cells 1 to 5 would be filled). Then I start pushing button B (and column B cells 6 to 10 would have the number "1", while those cells in column A would have "0"). Then again I push button A...

    Hope that may make it a bit more clear.
    Thanks again for the help,

    Sam

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,523

    Re: How to autofill a column depending on data in another column

    You will need VBA to do this as you cannot have both a formula and value in a cell


    .
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by JohnTopley; 11-11-2021 at 10:04 AM.

  6. #6
    Registered User
    Join Date
    11-06-2021
    Location
    Belgium
    MS-Off Ver
    2016
    Posts
    3

    Re: How to autofill a column depending on data in another column

    Thank you JohnTopley!

    This is exactly what I need. Works perfectly

+ 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] Copy one column, but loop through a second column multiple times depending on first column
    By redapplesonly in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-08-2019, 10:12 AM
  2. Autofill down a column using another sheet row data and skip one column each time
    By JohnPollardMDD in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-18-2019, 07:57 PM
  3. [SOLVED] AutoFill Column A with current date and time when entering data into Column B
    By Colteryahn in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 05-27-2016, 10:18 AM
  4. [SOLVED] Need data in column K to be auto populated, depending on drop down selection in column J
    By skeithnavo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-12-2015, 11:53 AM
  5. Replies: 2
    Last Post: 09-04-2013, 07:59 PM
  6. Worksheet function to Autofill formula in column A when data entered in column B
    By boylers75 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-07-2013, 02:27 PM
  7. Replies: 1
    Last Post: 03-11-2006, 07:50 AM

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