Date Ranges won't group in filter

  • Hi All,


    I have a unique problem that usually a text to columns macro fixes as per below.



    Code
    Columns("D:D").Select
        Selection.texttocolumns Destination:=Range("D1"), DataType:=xlDelimited, _
            TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
            Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
            :=Array(1, 1), TrailingMinusNumbers:=True


    My problem is as below (please refer to problem jpg). The group dates won't group with the other dates.


    I've tried everything from copy and paste special as values


    Then changing the date format to


    Code
    .NumberFormat = "dd/mm/yyyy"



    But nothing[ATTACH=CONFIG]69595[/ATTACH]


    This is super frustrating.

  • Re: Date Ranges won't group in filter


    Without seeing your source data I would imagine that the dates are being stored as text. Trying multiplying the dates by 1, or adding zero to convert it to a number (use .pastespecial & multiply), and then apply your number format as above.


    Ger

    _______________________________________________
    There are 10 types of people in the world. Those that understand Binary and those that dont. :P


    Why are Halloween and Christmas the same? Because Oct 31 = Dec 25... ;)

    _______________________________________________

  • Re: Date Ranges won't group in filter


    Yeah they are, which is why I tried using a text to columns method. This works when doing it manually, but after recording it and using that, it doesn't want to budge oddly enough.


    I'll give your method a go.

  • Re: Date Ranges won't group in filter


    Also, make sure there is no single apostrophe (') in the cell before the text date.


    If that doesnt work, there are about 10 different methods, with examples on how to convert text to dates in this page here... its as good as I have seen.


    https://www.ablebits.com/offic…/excel-convert-text-date/


    They cover off pastespecial with addition (my suggestion above) and also text to columns (which is what you were trying).


    Ger

    _______________________________________________
    There are 10 types of people in the world. Those that understand Binary and those that dont. :P


    Why are Halloween and Christmas the same? Because Oct 31 = Dec 25... ;)

    _______________________________________________

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!