# Excel Conditional Copy

Not open for further replies.

Joined:
Apr 5, 2012
Messages:
1
Hello,

I have a question concerning 57 workbooks I have. Each one follows the same layout and has many sheets in it. I want to figure out a formula or code that can copy a certain row if it finds a few conditions are met. Essentially I have a header row, a date column in A, independent data that needs to be copied in columns B-F, and conditional data in Columns G and H. I also have data in the first few rows of Columns I-K but I do not wish to copy that. I have multiple other sheets formatted the same way which will contain the copied information.

I think it will be simpler to explain the data before I continue. The data I am using is United States Presidencies. I have divided the terms into halves. Therefore, each president may have up to 4 halves as he can serve 2 terms. This is why the data needs to be copied into multiple spreadsheets.

What I'd like to do is the following,

I wish for a row to be copied if it meets two criteria; a number (1 or 2), and whether that number is part of the first or second term. The problem is that the first or second half of either term is always denoted by a 1 or 2.This is regardless of whether is was part of the first term or second. There will be a negative difference of 1 however in Column H when the terms change. There will also be a gap of at least 1 year to be safe. I have included a workbook to help illustrate what I mean. Don't worry, this is publicly accessible data.

In the example I have, I would like a row in 'Wilson Daily' to be copied over to 'Term I, First Half' if it meets the following conditions. It must have the value 1 in Column G. The difference between it and next row in column H has to be positive or not -1. This way, the halves are separated by terms. Essentially I'll change this formula to meet my other criteria because there are 10 other sheets like 'Term I, First Half' which have different conditions. I would like it to be more automated because I have 57 workbooks like this and it is already a process to format them properly. I also would like it if the row is copied without copying Columns I-K.

I am wondering of this is at all possible and how I would go about this because I have struggled to find an answer. Thank you very much for any help. I am also glad to elaborate if it is needed.

File size:
138.2 KB
Views:
47
As Seen On