Home > database >  Remove rows based on date and hour in Excel
Remove rows based on date and hour in Excel

Time:10-06

I have dataset of date and hours. I need to remove data before 06:00 and after 18:00 to each day. Is there any formula to do that automatically in excel?

enter image description here

CodePudding user response:

If you have Excel 365 you can use the FILTER-function - together with the MOD - logic to retrieve the time part of a date. (you will find a lot of explanations about this topic on SO - 0.25 equals to 6:00 and 0.75 to 18:00):

=FILTER(tblData,(MOD(tblData[Date],1)>=0.25)*(MOD(tblData[Date],1)<=0.75))

I named my table tblData and the field that I am filtering on is Date. You might have to adjust this.

enter image description here

CodePudding user response:

enter image description here

I tried this function and the result was this one. Can you help me. Maybe i did it wrong

  • Related