+ Reply to Thread
Results 1 to 4 of 4

Insert new row based on values

  1. #1
    Registered User
    Join Date
    06-24-2015
    Location
    Wisconsin
    MS-Off Ver
    Excel 2013
    Posts
    49

    Insert new row based on values

    Hi,

    I have an excel spreadsheet that has the following columns/data:

    | STUDENT | ITEM | NETAMT | PREVPAID | NEWAMT | REVERSAL |
    | 1234567 | 1234 | 0.00 | 866.00 |
    | 1234567 | 4321 | 615.50 | 1256.50 |

    I have the above excel spreadsheet that I would like to perform a calculation on in addition to adding a new row depending on certain values. Here is my IF statement and below this is what I would like the final result to be. Calculation = If netAmount > 0 then NewAmount = previousPdAmt, ReversalInd = Y and INSERT a new row with New Amount = netAmount, ReversalInd = N ELSE NewAmount = previousPdAmt.

    | STUDENT | ITEM | NETAMT | PREVPAID | NEWAMT | REVERSAL |
    | 1234567 | 1234 | 0.00 | 866.00 | 866.00 | Y |
    | 1234567 | 4321 | 615.50 | 1256.50 | 1256.50 | Y |
    | 1234567 | 4321 | 615.50 | 1256.50 | 615.50 | N |

    Is this possible?

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Insert new row based on values

    Hi,

    Here's one macro

    Please Login or Register  to view this content.
    Usual caveat. There were only two rows of data (we usually like a good representative sample) so if your actual data has a different layout or is not consistent with these two rows then there may be unexpected results.
    Last edited by Richard Buttrey; 06-01-2016 at 01:23 PM.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    06-24-2015
    Location
    Wisconsin
    MS-Off Ver
    Excel 2013
    Posts
    49

    Re: Insert new row based on values

    There could be more than 2 rows in the first layout. I just didn't want to list everything. There could also be more than one student ID.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Insert new row based on values

    Quote Originally Posted by mklindquist0815 View Post
    There could be more than 2 rows in the first layout. I just didn't want to list everything. There could also be more than one student ID.
    I don't understand the implications. Are you saying that you don't want to process every row in its own right?

+ 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] Insert 2 rows where based on cell values
    By Penn in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-05-2014, 12:32 AM
  2. Insert Row and Values based upon condition
    By btamulis in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-04-2014, 01:52 PM
  3. Replies: 2
    Last Post: 03-12-2013, 04:10 PM
  4. [SOLVED] Insert values based on a numeric value
    By mainroad in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-25-2013, 06:01 PM
  5. After insert new record, insert values in row based on first cell in row
    By frankienap in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-04-2012, 11:36 AM
  6. Insert Rows based on Cell Values
    By macrobatics in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 01-23-2011, 04:41 PM
  7. Excel 2007 : Insert Shapes based on Values
    By ramalingamr in forum Excel General
    Replies: 2
    Last Post: 11-10-2009, 10:21 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