Help comparing ordering dates stored as text AND dates stored as custom dates

qapla47

New Member
Joined
Jun 23, 2016
Messages
24
Hi All,
I have a spreadsheet which re-orders on a few different criteria, but need help modifying my sort on date (my third level sort) to allow for both dates stored as text as well as the dates stored as actual date formats.

We use both formats to indicate different requirements:
Text format means a must deliver by date stipulated by the customer (Shows as 5/5/17, number format text)
Date formats mean a delivery date we assigned to the job (Shows as 5-May, standard excel date, number format custom)

I also have conditional formatting set to work for both text and date in that column.

Here's my current code:
Code:
Sub SortLocationThenPriority()
'
' SortLocationThenPriority Macro
'


'
    Cells.Select
    ActiveWorkbook.Worksheets("6.23").Sort.SortFields.Clear
    
    'First sort on the Location of the job, held in Col P
    ActiveWorkbook.Worksheets("6.23").Sort.SortFields.Add Key:=Range("P2:P212"), _
        SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:= _
        "Hold,D. Pre-Press,Digital Press,GS6000,Pre-Press,DI,R5,Die Cut,Bindery,H Assem.,Outside,Delivery,Billing" _
        , DataOption:=xlSortNormal
        
    'Second sort on the Priority level of the job, held in Col O
    ActiveWorkbook.Worksheets("6.23").Sort.SortFields.Add Key:=Range("O2:O212"), _
        SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
        
    'Third sort on the Due Date of the job, held in Col E
    'Here is where I need help, comparing both cells with "text dates" and "Excel Dates" to the current date
    'But without changing
    ActiveWorkbook.Worksheets("6.23").Sort.SortFields.Add Key:=Range("E2:E212"), _
        SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("6.23").Sort
        .SetRange Range("A1:R212")
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
End Sub

Thanks for any help!
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Doing that, would you be able to suggest how to use conditional formatting to change the appearance of the date type? This is in part, why we have it formatted differently than the other dates.
The Text formatted dates have color applied to them, in addition to being formatted differently from the other dates (again, this is to be a quick view way of knowing which things are driven by customer dates and which are a matter of convenience)

I'm currently using this formula to conditionally format the text dates:
=(and(istext(E2),(and(value(E2)>=Today()+2, value(E2)<=Today()+7)))

while I'm using the format only cells that contain [Cell value between =today()+2 and today()+7] to conditionally format the "date" dates.
 
Upvote 0
am I right in thinking you might put a delivery date in a cell, then later customer stipulates a different date in that cell

if so .....say A1 is where you put the date and B1, at present blank, is for any date customer might stipulate

so C1 can be defined as =if(B1="",A1,B1)

now use whatever date is in C1 and if you like apply conditional formatting to C1 =B1<>""
 
Upvote 0
It is a production schedule, yes, which currently has 17 columns of information relating to the job. Due date is column 5. There are also several macros that look at the data, or the date, and adjust certain aspects of it (sorting, applying headers, formatting information, applying borders)
Due dates can either be stipulated by the customer, creating a "hard date" that a job MUST be completed by, or the date can be assigned by us, creating a "soft date" based solely on our schedule of jobs.
We indicate the difference by using text dates, which have purple text and format into that 5/5/17 format (see the last line) for the Hard Dates. Soft dates are excel date formats which have colors that change based on the background color of the cell. The background cell color changes in relation to the time remaining before the due date (in a rough stop light format, with the addition of black for past due).

Job #ClientDescriptionQtyDue DateStock OrdStock inCo.Press/ImpoInk PlatedStatusChangesBindery / Outside Services / NotesLast ContactPriorityCurrentNext
HOLD 0HoldHold
20516Liberty Pumps 150 out 4/21French APB1500pt 4/21tagged R5 3 forms s/w4/4On Hold01 MayBOOKLET, 3H & shrink-wrap21 Apr HoldDelivery

<tbody>
</tbody>
DIGITAL PRE-PRESS 0D. Pre-PressD. Pre-Press
20748Once Again Nut ButterCircle labels250012-May4-May10-MayOnlineDigital4/0Need PDF Proof rebox05 May1D. Pre-PressDigital Press
20754McCormack ProdBusiness Card Magnets200019-MayBiz Mag Biz Mag4/0Need PDF Proof Biz Mag to produce05 May2D. Pre-PressDigital Press
20755RotorkBusiness Cards & Flyers1m / 60012-Mayhouse Digital4/0 4/4Need PDF Proof trim05 May3D. Pre-PressDigital Press
clip_image003.gif
clip_image004.gif

<tbody>
</tbody>
20753Morgan MgmtFloor Plans (8) and labels100/36011-May5-May10-MayOnlineDigital4/0Need PDF Proof trim07 May4D. Pre-PressDigital Press
20753Morgan MgmtThe Archer Referral Labels20 shts11-Maycheck Digital4/0Need PDF Proof rebox07 May5D. Pre-PressDigital Press
20696Morgan ManagementUniversity Green Floor Plans (6ver)100ea2-Mayhouse Digital4/0Proof trim27 Apr D. Pre-PressDigital Press
20745Morgan ManagementPerrys Crossing trifold25010-Mayhouse Digital4/4Proof trim, score, fold04 May D. Pre-PressDigital Press
20727NE Sealcoating3pt NCR Proposal Form100012-May5-May8-MayLMDigital4/0Proof 2Madetrim, pad for NCR05 May D. Pre-PressDigital Press
20717YMCAOneYNation postcard mailing36,00016-MayR5 R5/Digital / Mail1/0Wait for R5 trim to four up blocks for C7 run27 Apr D. Pre-PressDigital Press
clip_image005.gif

<tbody>
</tbody>
20681Klein Steel Catalog 158 p + 13 tabs + cover50023-Mayorder Digital / R54/4Proof 2 trim, collate, wire bind02 May D. Pre-PressDigital Press
DIGITAL PRESS 0Digital PressDigital Press
20728ParlecOmega Sales Flyer5005/8house Digital4/4Approved07 Maytrim07 May3Digital PressBindery

<colgroup><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col span="2"><col span="4"></colgroup><tbody>
</tbody>
 
Upvote 0
if it were me I would have a helper column with C meaning customer stipulated and S meaning soft date - then all conditional formatting can be driven by that one cell...
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,436
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top