Sort help needed

JudyHNM

New Member
Joined
Dec 21, 2015
Messages
18
I am using Access 2016. I have a large list of numbers and text that I want to be sorted within the form. In the table, the field is defined as text as there are some text values that have to be entered. When I use a query to sort the records, I end up with 327, 3325, 3326, 333 when I want the sort to appear as 327, 333, 3325, 3326. How I can I get the data to sort this way?

Thanks, Judy
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
How should values of null or text values be sorted - at the beginning or end?

I would add in a calculated field to your query, sort on this first and then by your field... something like:

Code:
SortOrder: IIf(IsNumeric(Nz([MyField],0)),Val(Nz([MyField],999999)),999998)

If your field value can be higher than 999998 then adjust as appropriate. This way the numbers would be sorted first, then the text values and then the null values.
 
Upvote 0
It doesn't matter to me where nulls end up as long as it's consistent, I can deal with it. My "text numbers" are 3 and 4 digits in length so this is more than adequate. I will give it a try -- thanks so much for your response.

Judy
 
Upvote 0

Forum statistics

Threads
1,221,691
Messages
6,161,310
Members
451,696
Latest member
Senthil Murugan

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