Jak utworzyć niestandardowe sortowanie, gdy zwykłe sortowanie nie działa w programie Excel

Węzeł źródłowy: 1120745

Not all sorts in Excel are alphabetical. Sometimes, you need to sort by an irregular set of terms, and when that happens, you need to create a custom sort. Here’s how.

Microsoft Excel na ekranie

Zdjęcie: Wachiwit/Shutterstock

Więcej o systemie Windows

Sortowanie jest łatwe przewyższać; you literally click an option and Excel does the rest. Occasionally, if Excel’s not certain how many columns to include in the sort, it will ask, but other than that, sorting is one of the simplest tasks you’ll perform in Excel. I’m talking about ascending and descending sorts, which won’t always be adequate. For instance, what if you want to sort by the days of the week: Monday, Tuesday, Wednesday, and so on? A simple sort won’t get the job done. That’s why Excel includes a custom sort feature. You can create a unique sort order, such as the days of the week. This article will show you how to create a custom sort when you have an irregular sort order.

WIDZIEĆ: 83 wskazówek dotyczących programu Excel, które każdy użytkownik powinien opanować (TechRepublic)

używam Microsoft 365 pulpit na Windows 10 64-bit system, but you can use earlier versions. Excel Online will run an existing custom sort, but you can’t create them online. For your convenience, you can pobierz pliki demonstracyjne .xlsx i .xls. W tym artykule założono, że znasz podstawowe umiejętności obsługi programu Excel, ale nawet początkujący powinien być w stanie postępować zgodnie z instrukcjami, aby odnieść sukces.

Jak sortować według terminów w Excelu

A custom sort is one you define. For instance, you might need to sort T-shirts by small, medium, large and extra-large. Or you might sort temperatures by cold, warm and hot. A regular sort can’t handle these types of requirements. In this case, I’ll refer to these sort elements as “terms.” Fortunately, using the Sort feature, you can easily define a custom sort that handles terms.

Sortowanie niestandardowe można rozpocząć na dwa sposoby:

  • Na karcie Strona główna kliknij opcję Sortuj w grupie Edycja, a następnie opcję Sortowanie niestandardowe.
  • Na karcie Dane kliknij opcję Sortuj w grupie Sortuj i filtruj.

Now, let’s take on a contrived example—I’m doing so because it is so unique, and many of you will have peculiar sorting requirements that make no sense to anyone else but you. Rysunek A shows a simple data set of regions. You could sort alphabetically, both ascending and descending. But let’s suppose, instead, that you want a specific sort order: Southwest, Central, Northwest. Neither an ascending nor descending sort will work. Southwest, Central, and Northwest are the sort REGULAMIN.

Rysunek A

  Let’s create a custom sort by regions.

”Kredyt danych>Excelcustomsort1-a.jpg

  Let’s create a custom sort by regions.

Aby utworzyć ten rodzaj, wykonaj następujące czynności:

  1. Kliknij w dowolnym miejscu zbioru danych.
  2. Kliknij kartę Dane, a następnie kliknij opcję Sortuj w grupie Sortuj i filtruj. (Ta trasa wymaga jednego kliknięcia mniej niż karta Strona główna).
  3. W wyświetlonym oknie dialogowym wybierz Region z listy rozwijanej Sortuj według, ponieważ chcesz sortować według wartości Regionu.
  4. Pozostaw sortowanie włączone z wartościami komórek jako ustawienie domyślne.
  5. Z listy rozwijanej Kolejność wybierz Sortowanie niestandardowe, co otworzy nowe okno dialogowe, w którym możesz utworzyć sortowanie niestandardowe (listę).
  6. W kontrolce Wpisy listy wprowadź Południowy zachód, środkowy, północny zachód—terminy sortowania w kolejności, według której mają być sortowane (Rysunek A).
  7. Kliknij Dodaj, aby przenieść nową listę do kontrolki Listy niestandardowe po lewej stronie (Rysunek B).
  8. Kliknij OK, aby powrócić do okna dialogowego Sortowanie, w którym będzie teraz wyświetlana nowa lista w kontrolce Kolejność (Rysunek C).
  9. Kliknij OK, aby posortować zbiór danych.

Rysunek B

  Dodaj nową listę terminów sortowania. 

”Kredyt danych>Excelcustomsort1-b.jpg

  Dodaj nową listę terminów sortowania. 

Rysunek C

  Nowa lista jest teraz ustawieniem Kolejność.

”Kredyt danych>Excelcustomsort1-c.jpg

  Nowa lista jest teraz ustawieniem Kolejność.

Jak widać w Rysunek D, the data set now sorts by the custom list. Southwest sorts first, followed by Central, and then Northwest. Custom sorts don’t always make sense, but it’s great to know how this works. 

Rysunek D

Zbiór danych sortuje się według listy niestandardowej.

”Kredyt danych>Excelcustomsort1-d.jpg

Zbiór danych sortuje się według listy niestandardowej.

Aby ponownie użyć sortowania, kliknij Sortuj i wybierz Sortowanie niestandardowe z listy rozwijanej Kolejność. Wybierz listę w kontrolce Listy niestandardowe i kliknij OK.

You might be wondering if a data set can have more than one custom sort. Yes, it can. Let’s create a second custom sort that sorts by the Personnel values in the following order: Rosa, June, James, Martha, Luke, Mark. To do so, repeat the instructions above until step 3 and choose Personnel from the Sort By dropdown. At step 6, enter Róża, Czerwiec, Jakub, Marta, Łukasz, Marek, jak pokazano w Rycina E.. Kliknij przycisk Dodaj, a następnie dwukrotnie kliknij przycisk OK. Rycina F. pokazuje wyniki. Możesz dodać tyle niestandardowych sortowań, ile potrzebujesz.

Rycina E.

  Wykonaj niestandardowe sortowanie według personelu.

”Kredyt danych>Excelcustomsort1-e.jpg

  Wykonaj niestandardowe sortowanie według personelu.

Rycina F.

  Tym razem sortowanie niestandardowe sortuje według personelu.

”Kredyt danych>Excelcustomsort1-f.jpg

  Tym razem sortowanie niestandardowe sortuje według personelu.

Admittedly, the examples are a bit contrived and might not make sense—unless you’re the person asked to sort records this way. Then, knowing how to use this feature will make you look great!

Wkrótce ruszamy

Excel supports a second custom support: sorting by multiple columns. In a future article, I’ll show you how to use this same feature to sort by multiple columns. 

Zobacz także

Źródło: https://www.techrepublic.com/article/how-to-create-a-custom-sort-when-a-regular-sort-wont-do-in-excel/#ftag=RSS56d97e7

Znak czasu:

Więcej z Oprogramowanie na TechRepublic