Sort column issue in one cell

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,738
Office Version
  1. 2007
Platform
  1. Windows
Evening,
I have two macros of which one sorts column G Ascending & the other Descending.
The column in question is date format.
The code in use is supplied below.
I use the same code for both & just changed one to Descending etc.
My problem is that cell G4 when Descending is incorrect, Ascending is fine.

Example
G4 =18/09/2017
G5 =03/11/2017
G6 =30/10/2017
G7 =27/09/2017

One thing i did notice is the date in cell G4 shows an upside down v before the date where other cells just show the date,if that helps.

Code:
Private Sub SortDateoldnew_Click()    
    Dim x As Long
    
    Application.ScreenUpdating = False
    
    With Sheets("HONDA LIST")
        If .AutoFilterMode Then .AutoFilterMode = False
        x = .Cells(.Rows.Count, 1).End(xlUp).Row
        
        .Range("A3:G" & x).Sort Key1:=Range("G4"), Order1:=xlAscending, Header:=xlGuess
        
    End With
                      
    ActiveWorkbook.Save
    
    Application.ScreenUpdating = True
    Sheets("HONDA LIST").Range("A4").Select
    
End Sub
 
Last edited:

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
So the example you posted, is that shown in Descending order? Where G4 is wrong, 18/09/2017 should be the last value ?

Sounds like the date in G4 isn't actually a date, but a text string.
What does this return
=ISNUMBER(G4)
 
Upvote 0
Hi,
Example shown is Descending.
Cell G4 is show as Date in Foramt Box,middle top of screen.

If i put =ISNUMBER(G4) in address bar for cell G4 the cell then shows 00/01/1900
When i then sort it sorts correctly.
 
Upvote 0
It doesn't matter how the cell is 'formatted'
A cell can be formatted as a Date and yet not actually 'contain' a date.

I meant for the ISNUMBER(G4) formula to be put in an available 'empty' cell.
It's intended to test if the value in G4 is actually a date or not.
 
Upvote 0
OK
The first available cell is G240.
When i first put it there i then see o
But when i use the sort macro its now changed to TRUE
 
Upvote 0
Sounds like that value in G4 (as shown in your original post) is not a real date.
Try re-entering that date.
 
Upvote 0
I’ve tried but no joy.
I’ve even copied another date from a different cell and pasted it.

Why is this the only cell where I see an upside v before the date.

What is the upside down v anyway.
 
Upvote 0
Is it this ^ ? It's called a Carrat (not sure of the spelling)
It's the power operator, like 2^10 = 2 to the power of 10

And is that actually IN the cell, as a character?
Well that is what is making it not a date, but a text string.

How it's getting there, I have no idea to offer on that.
 
Last edited:
Upvote 0
Yes that is the symbol.
It’s not in the cell but if I click the cell then look above in say what’s called the address bar I see ^18/09/2017 but it should just show 18/09/2017
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,301
Members
452,633
Latest member
DougMo

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