Copy / paste specfic DATE to other worksheet.
Solved/Closed
Related:
- Copy / paste specfic DATE to other worksheet.
- Transfer data from one excel worksheet to another automatically - Guide
- How to paste photo in resume - Guide
- Copy and paste fonts - Guide
- How to automatically transfer data between sheets in Excel - Guide
- Grade formula in excel worksheet - Guide
1 response
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Aug 17, 2010 at 11:19 PM
Aug 17, 2010 at 11:19 PM
You can add this formula
=IF(OR(AND(B$17<>"",OR(YEAR(I2)=B$17,YEAR(J2)=B$17,YEAR(K2)=B$17)),AND(B$18<>"",OR(YEAR(I2)=B$18,YEAR(J2)=B$18,YEAR(K2)=B$18))),1,0)
Filter on "1"
Copy the range
If you need macro, you can record your action
=IF(OR(AND(B$17<>"",OR(YEAR(I2)=B$17,YEAR(J2)=B$17,YEAR(K2)=B$17)),AND(B$18<>"",OR(YEAR(I2)=B$18,YEAR(J2)=B$18,YEAR(K2)=B$18))),1,0)
Filter on "1"
Copy the range
If you need macro, you can record your action
Aug 18, 2010 at 02:40 AM
However, there is a new situation here. I now got more years that i need to do the filter and i want seperate sheet for each year.
So, instead of manually type in the data, i have used VBA to find the year range, put into one column and delete all duplicate ones. The task is similar, but since excel could give more than 20 years, it would be tendious to do all the filtering maunally. AND, now i need excel to seperate the rows that contain the specific year range in any one the three cells and put them into a new sheet.
e.g.
The years that excel could find in the three columns(F:H) are ( 2001,2003,2006,2010, 2012,2020.....2033).. and they are pasted in column "S" in sheet 1. How could i tell excel create new sheets for the years ( sheets 2001, sheets 2003, sheet2006....),search through column (F:H) in sheet 1 to see if ANY of those columns contain that year, and paste them into the new sheet. To be more specific, in the newly created "Sheet 2001", the entire row where column(F:H) contains "2001" should be pasted. and in the newly created "Sheet 2033", the entire row where column(F:H) contains "2033" should be pasted..
Enclosed please find the reference.
https://authentification.site/files/23851477/Book32.xls
I have got sheet "2002" and "2003" here as results but for the real one i will need more years' sheets (as many as how many excel could extract in the previous stage; as shown in column L ) ......
I think this task should be quite usual (extracting by date), but i couldnt google the result....Pleas help!!
Aug 18, 2010 at 02:41 AM
Aug 18, 2010 at 07:21 AM
Loop thru each year and apply formula. Filter the result and copy the visible rows to the sheet
Aug 19, 2010 at 01:17 AM
So far i could only figure out how to give sheet names to the newly created worksheet:( not even sure if it is looping)
Dim i As Long, LR As Long, sName As String
i = 2
5
If Cells(i, 19) = "" Then GoTo 10 ' I'm trying to count the no. of year
i = i + 1: GoTo 5
10
N = i - 1
For i = 2 To N
sName = Sheet4.Cells(i, 19).Value
Worksheets.Add(after:=Worksheets(Worksheets.count)).Name = sName
Next
I tried to code you suggest and filtered,
Range("K2").Select
ActiveCell.FormulaR1C1 = _
"=IF(OR(AND(RC[8]<>"""",OR(YEAR(RC[-5])=R2C19,YEAR(RC[-5])=R2C19,YEAR(RC[-3])=R2C19))),1,0)"
It works... but i simply couldn't find a way to put the pieces together...can you give me any hints? This task is driving me insane!
Thanks again!
Aug 19, 2010 at 05:22 AM
https://ccm.net/forum/affich-258700-interesting-question-for-excel-champions
That code first creates a list of unique value to see what we have to loop thru, you dont have that case as you already know
Then it loops for each value, apply filter and create sheet and copy the data. For you the change would be that as it loops thru each value, you have to apply formula first, then apply filter and when it comes to creating sheet, it uses the value that was used to filter, you either have to change formula to use year, instead of 1 as flag or when you create sheet, use the year
see if it makes any sense to you