iSnare.com - Free Content Articles Directory
Authors Contents [Advanced Search][Add OpenSearch][Job Search]
Distribute your articles to thousands of article sites for only $2 and below! Read more...

Index  Computers and Technology
 

Ms Access And Ms Excel - What To Do When Sorting Does Not Work

 
[ Contact the Author] [ Send to a Friend] [ Article Publisher] [Make PDF] [ Print] [ Bookmark & Share]
 
Read our Terms of Service before reprinting this article. The submitter specified above has claimed the rights to this article.
Richard Killey

In both Microsoft Access and Microsoft Excel it is very easy to sort columns of text or numbers. Both programs supply us with toolbar buttons that allow either ascending sorts (1 ... 999) or descending sorts (999 ... 1). The Ascending button has a blue "A" above a red "Z" with a downward pointing arrow to the right of the 2 letters. The Descending button has a red "Z" above a blue "A" with a downward pointing arrow to the right of the 2 letters. Simply put the cursor in the column you want sorted and click once on the appropriate button.

As I stated in that first paragraph, this works great for text or numbers. The challenges start when you want to sort mixed text and numbers. Here are 2 simple real life examples. (NOTE: the remainder of this article assumes we want ASCENDING sort order)

Example 1: Part Numbers. On a computer, which comes first?

- W4
- W39
- W212

Example 2: Addresses. On a computer, which comes first?

- 4 Main Street
- 39 Main Street
- 212 Main Street

In both cases, the computer sorts them opposite to the way a human would normally want them sorted. A human automatically looks at the entire string of characters and then sorts using a more complex algorithm than a basic computer program’s sort logic, like that found in Access and Excel. To a computer, 2 comes before 4, so W212 sorts before W4.

Let’s examine the Part Numbers problem first.

If possible, have the way parts are numbered standardized so that all part numbers have the same number of characters. In our example, use W000004 and W000039 and W000212. This scheme allows for 999,999 unique part numbers AND it sorts the way we would expect it to sort.

If it is too late, and you cannot create the required pattern, then create a new field in Access or a new column in Excel, and call it PartNumberSortable. Then, in Access, create a query that converts all the existing part numbers to a sortable version. It will be an update query with update logic like this placed under the PartNumberSortable column in the query:

left([PartNumber],1) & format(mid([PartNumber],2),"000000")

All reports and queries can now continue to list your traditional part numbers, but they can be sorted by the new field, PartNumberSortable, which would stay hidden. You would also have to modify any of your data entry forms and routines so that they generate the new field automatically.

In Excel you can create a formula for the new column. Here is one that works.

=LEFT(A1,1) & RIGHT("000000" & MID(A4,2,8),6)

This formula assumes that the original part number is in column A.

The address problem? Trickier. I’ll tackle that one in another article. In the meantime, for more MS Access tips like this, visit http://www.databaselessons.com

p.s. All the examples were processed on a computer with MS Office 2000; newer versions of Access and Excel may work slightly differently, or have more intelligent sort capabilities.

Important NoticeDISCLAIMER: All information, content, and data in this article are sole opinions and/or findings of the individual user or organization that registered and submitted this article at Isnare.com without any fee. The article is strictly for educational or entertainment purposes only and should not be used in any way, implemented or applied without consultation from a professional. We at Isnare.com do not, in anyway, contribute or include our own findings, facts and opinions in any articles presented in this site. Publishing this article does not constitute Isnare.com's support or sponsorship for this article. Isnare.com is an article publishing service. Please read our Terms of Service for more information.

Richard Killey has been creating MS Access databases since 1996. His Access websites have been online, helping thousands of beginners learn VBA, since 1997. More MS Access tips can be found at the Database Lessons Website.

Article Tags: access [See Dictionary], numbers [See Dictionary], part [See Dictionary]
Got a question about this article? Ask the community!
Article published on April 25, 2007 at Isnare.com
 
Rate this article:

Importing Text Files Into An Ms Access Database
Submitted by: Richard Killey

In some of the MS Access databases that you develop, there may be a need to import data from text files, also referred to as ASCII files or flat files...

Sony Ericsson W595 Mobile Phone Review - The Latest and Best Walkman Phone?
Submitted by: Carlson Osbourne

The one thing that most Sony Ericsson phones have in abundance is good looks No matter what lies beneath the surface, they all tend to have unique and beautiful appearances that can enhance the style factor of everyone using them...

Sony Ericsson W705 Mobile Phone Review - Tune Into the Beat With the Ultimate Walkman Phone
Submitted by: Carlson Osbourne

Sony Ericsson is known the world over for their amazingly functional and stylish mobile phones It is easy to see why when you take a look at some of the handsets that they have produced over the years and one of their latest additions to the Walkman range can be added to that illustrious list...

Notebook - Smart Shopping Tips
Submitted by: Roberto Sedycias

There are many choices of notebooks and sometimes it is hard to find the appropriate notebook that represents the true value for money...

The Many Applications of GPS Cell Phone
Submitted by: Roberto Sedycias

GPS is known to navigate global positioning easily and is widely used in vehicle tracking and map navigation, benefiting people in their daily needs...

Things To Know About Formatting Your Memory Card
Submitted by: Lance Edwards

If you use a new memory card on your digital camera for the first time you should always format it, or it may not store your photos correctly...

Choosing a Scanner
Submitted by: Lorraine Vybihal

When choosing a scanner for your business, there are many things you need to consider You need a scanner that is fast, reliable, and that will increase your overall productivity...

Linux Vs Windows - Which One to Pick?
Submitted by: Roberto Sedycias

Choosing the appropriate operating system is based on the server`s function Linux is powerful and has a versatile operating system while Windows is well-known for its easy to use operating system and versatility...

Nintendo Wii Vs Playstation 3 - A Genuine Combat
Submitted by: Roberto Sedycias

Nintendo Wii and Playstation 3 are the top-notch gaming consoles commanding the market However, knowing the difference of Nintendo Wii Vs Playstation 3 gives clarity about each gaming console and its features...

Nokia 5800 XpressMusic Mobile Phone Review - The Trendsetter of Nokia Touch Screens
Submitted by: Carlson Osbourne

Behind all of their market competitors they may be but Nokia have now introduced their very first touch screen phone...

Nokia 6260 Slide Mobile Phone Review - Mobile High Speed Technology at Your Fingertips
Submitted by: Carlson Osbourne

The Nokia 6260 Slide is one of the latest additions to the Nokia mobile phone handset family and also one of the most modern...

Canadian Address Database Helps Immigrants Better Adapt to the Country
Submitted by: Adrianna Noton

An address database can be a godsend to persons who are new to a country This is especially true for Canada where immigration is an important part of the country’s development...

Reverse Cell Phone Lookup - Did You See a Number on Your Spouse's Cell You Did Not Recognize?
Submitted by: J Williams-Foster

Reverse cell phone lookup services can provide information about phone number owners for a myriad of reasons, one reason that's not always considered is in the area of love...

How to Dispose of a Multifunction Printer
Submitted by: Derek Rogers

As with most electrical equipment, your printer is full of plastics, components and potentially hazardous materials...

The Time For Buying a GPS System is Now
Submitted by: Jerbob Johnsen

Whether you are trying to decide on an auto GPS systems to window shop or purchase GPS autos system, you have definitely now have many choices compared to a few years ago...

Top 5 Camcorders - Which One to Pick?
Submitted by: Roberto Sedycias

Purchasing camcorders leads the buyer to view a wide range of choices; however, looking for the appropriate choice depends on the need of the buyer and budget...

Isnare.com Footer Divider

© 2004-2009. Isnare Free Articles - An Isnare Online Technologies Free Articles Project. All Rights Reserved.   Privacy Policy