+ Reply to Thread
Results 1 to 2 of 2

VBA - Creating new column (Columns M) with values based on previous column (Column L)

  1. #1
    Registered User
    Join Date
    01-20-2020
    Location
    Houston, Texas
    MS-Off Ver
    2016
    Posts
    5

    Post VBA - Creating new column (Columns M) with values based on previous column (Column L)

    I am having trouble coming up with a VBA code creating a new column with values based on an existing column. The code I have is shown below. Attached is an image of the excel file I am working with. I am initially extracting an excel file from SAP, so the column values (Start Date) are constantly changing (both the values and the number of values. Column L ('Days') was obtained based on the previous column J ('start date'). I am trying to make Column M ('Aged') based on what Column L ('Days') is. If Column L has a value of less than 6, I would like Column M = 0. Otherwise, I would like Column M = 1.

    Excel file.JPG

    (A/Z)
    Please Login or Register  to view this content.
    For some reason, the days value is being populated (as seen in the screenshot), but the aged row is being left blank (except for the header). Does anybody know why this would be the case? Is there something wrong with my if statement?

    Let me know if you need any more information. Thanks in advance for the help.
    Last edited by will12321; 01-21-2020 at 01:02 PM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2010 on Linux
    Posts
    12,120

    Re: VBA - Creating new column (Columns M) with values based on previous column (Column L)

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    I did it for you this time. Please read forum rules. Thanks

+ 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] VBA Creating a list of unique values from one column based on criteria from another column
    By bilbo85 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-09-2016, 02:38 PM
  2. [SOLVED] Concatenating values two columns (column B, column C) based on criterion
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2014, 11:31 AM
  3. Macro that moves Formulas 1 column right and then Pastes Values into previous column
    By ExcelDavid in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2014, 05:30 PM
  4. Creating new column/value based on values in three columns
    By rkwpnw in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-09-2013, 02:16 PM
  5. Concatenate values in a column based on value of previous column
    By CountySurveyor in forum Excel General
    Replies: 3
    Last Post: 10-02-2012, 06:38 PM
  6. [SOLVED] Unhide columns based on the previous column's value
    By dumbom in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-07-2012, 08:20 AM
  7. Replies: 10
    Last Post: 04-27-2010, 11:31 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