{"id":10034,"date":"2018-12-23T15:46:28","date_gmt":"2018-12-23T14:46:28","guid":{"rendered":"https:\/\/www.myexcelonline.com\/?p=10034"},"modified":"2023-11-30T17:36:56","modified_gmt":"2023-11-30T16:36:56","slug":"sortby-formula-in-excel","status":"publish","type":"post","link":"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/sortby-formula-in-excel\/","title":{"rendered":"SORTBY Formula in Excel"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p><em><strong>What does it do?<\/strong><\/em><\/p>\n<p>Sorts a table based on the column(s) specified<\/p>\n<p><em><strong>Formula breakdown:<\/strong><\/em><\/p>\n<p>=SORTBY(<span style=\"color: #0000ff;\">array<\/span>, <span style=\"color: #ff6600;\">by_array1, sort_order1<\/span>, <span style=\"color: #339966;\">[by_array2, sort_order2], &#8230;<\/span>)<\/p>\n<p><em><strong>What it means:<\/strong><\/em><\/p>\n<p>=SORTBY(<span style=\"color: #0000ff;\">data to be sorted<\/span>, <span style=\"color: #ff6600;\">by which column to sort first<\/span>, <span style=\"color: #339966;\">[by which column to sort afterwards], &#8230;<\/span>)<\/p>\n<hr \/>\n<p>Did you know that you can now sort your table data with an Excel Formula? Yes you can! It is definitely possible now with\u00a0<strong>Excel&#8217;s SORTBY Formula<\/strong>. It also allows you to sort by multiple columns as well. It is a new formula introduced in <strong>Office 365 released in 2018<\/strong>!<\/p>\n<p>We have a person list that we want to sort by Gender (ascending order) and then by Age (ascending order).<\/p>\n<p>Do take note that in specifying the sorting order, 1 represents ascending order, -1 represents descending order.<\/p>\n<p>I explain how you can do this below:<\/p>\n<div class=\"after-post-box\">\n<p><iframe src=\"https:\/\/www.youtube.com\/embed\/zs9x35Tv27g?rel=0 \" width=\"800\" height=\"400\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><span data-mce-type=\"bookmark\" style=\"display: inline-block; width: 0px; overflow: hidden; line-height: 0;\" class=\"mce_SELRES_start\">\ufeff<\/span><\/iframe><a href=\"https:\/\/www.youtube.com\/c\/MyExcelOnlinecomtutorials?sub_confirmation=1\" target=\"_blank\" rel=\"noopener noreferrer nofollow\"><img loading=\"lazy\" decoding=\"async\" class=\"alignmiddle wp-image-111468 size-full\" style=\"vertical-align: middle;\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/04\/1.yt_.png\" alt=\"\" title=\"\"><\/a><\/p>\n<p class=\"line-two\"><a class=\"IRPP_minimalist icon-download button small\" href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA.xlsx\" target=\"_blank\" rel=\"noopener noreferrer\" data-leadbox=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA.xlsx\" data-leadbox-id=\"147284833f72a2:12f08263ab46dc\"><span class=\"ctaText px-3 text-capitalize\">Download excel workbook<i class=\"fa fa-download\"><\/i><\/span><span class=\"postTitle px-3\">SORTBY-FORMULA.xlsx<\/span><\/a><\/p>\n<p class=\"line-two\">\n<\/div>\n<p><span style=\"color: #ff0000;\"><strong>STEP 1:<\/strong><\/span> We need to <strong>enter the <i>SORTBY\u00a0<\/i>function in a blank cell<\/strong>:<\/p>\n<h2 style=\"text-align: center;\"><span style=\"color: #0000ff;\">=SORTBY(<\/span><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"SORTBY Formula in Excel\"  class=\"aligncenter size-full wp-image-10434\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-01.jpg\" alt=\"SORTBY Formula in Excel\" width=\"843\" height=\"274\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-01.jpg 843w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-01-300x98.jpg 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-01-768x250.jpg 768w\" sizes=\"(max-width: 843px) 100vw, 843px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000;\"><strong>STEP 2:<\/strong><\/span>\u00a0The <b>SORTBY\u00a0<\/b>arguments:<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_57_1 counter-flat ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li><a href=\"#\" class=\"scroll-to-download\">Free Practice Workbook<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/sortby-formula-in-excel\/#array\" title=\"array\">array<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/sortby-formula-in-excel\/#by_array1_sort_order1\" title=\"by_array1, sort_order1\">by_array1, sort_order1<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/sortby-formula-in-excel\/#by_array2_sort_order2\" title=\"by_array2, sort_order2\">by_array2, sort_order2<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"array\"><\/span><span style=\"color: #0000ff;\"><em><strong>array<\/strong><\/em><\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>What is the data to be sorted?<\/strong><\/p>\n<p><em>Select the cells containing the person data, do not include the headers:<\/em><\/p>\n<h2 style=\"text-align: center;\">=SORTBY(<span style=\"color: #0000ff;\">B9:D14,<\/span><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"SORTBY Formula in Excel\"  class=\"aligncenter size-full wp-image-10435\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-02.jpg\" alt=\"SORTBY Formula in Excel\" width=\"843\" height=\"265\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-02.jpg 843w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-02-300x94.jpg 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-02-768x241.jpg 768w\" sizes=\"(max-width: 843px) 100vw, 843px\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"by_array1_sort_order1\"><\/span><span style=\"color: #0000ff;\"><em><strong>by_array1, sort_order1<\/strong><\/em><\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Which column will be used to sort first?<\/strong><\/p>\n<p><em>Select the cells containing the gender column, then type in 1 for it to be ascending order.<\/em><\/p>\n<h2 style=\"text-align: center;\">=SORTBY(B9:D14,<span style=\"color: #0000ff;\"> B9:B14, 1,<\/span><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"SORTBY Formula in Excel\"  class=\"aligncenter size-full wp-image-10436\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-03.jpg\" alt=\"SORTBY Formula in Excel\" width=\"836\" height=\"266\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-03.jpg 836w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-03-300x95.jpg 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-03-768x244.jpg 768w\" sizes=\"(max-width: 836px) 100vw, 836px\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"by_array2_sort_order2\"><\/span><span style=\"color: #0000ff;\"><em><strong>by_array2, sort_order2<\/strong><\/em><\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Which column will be used to sort next?<\/strong><\/p>\n<p><em>Select the cells containing the age column, then type in 1 for it to be ascending order.<\/em><\/p>\n<h2 style=\"text-align: center;\">=SORTBY(B9:D14, B9:B14, 1,<span style=\"color: #0000ff;\"> D9:D14, 1)<\/span><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"SORTBY Formula in Excel\"  class=\"aligncenter size-full wp-image-10440\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-04-1.jpg\" alt=\"SORTBY Formula in Excel\" width=\"988\" height=\"259\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-04-1.jpg 988w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-04-1-300x79.jpg 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-04-1-768x201.jpg 768w\" sizes=\"(max-width: 988px) 100vw, 988px\" \/><\/p>\n<p>Now it gets sorted magically!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"SORTBY Formula in Excel\"  class=\"aligncenter size-full wp-image-10438\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-05.jpg\" alt=\"SORTBY Formula in Excel\" width=\"843\" height=\"266\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-05.jpg 843w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-05-300x95.jpg 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/11\/SORTBY-FORMULA-05-768x242.jpg 768w\" sizes=\"(max-width: 843px) 100vw, 843px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #0000ff;\"><strong>How to Use the SORTBY Formula in Excel<\/strong><\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/ebooks.myexcelonline.com\/products\/101-most-popular-excel-formulas-e-book\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-10741\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/12\/MyExcelOnline.com-Formulas-E-Book.png\" alt=\"\" width=\"1200\" height=\"628\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/12\/MyExcelOnline.com-Formulas-E-Book.png 1200w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/12\/MyExcelOnline.com-Formulas-E-Book-300x157.png 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/12\/MyExcelOnline.com-Formulas-E-Book-1024x536.png 1024w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2018\/12\/MyExcelOnline.com-Formulas-E-Book-768x402.png 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" title=\"\"><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; What does it do? Sorts a table based on the column(s) specified Formula breakdown: =SORTBY(array, by_array1, sort_order1, [by_array2, sort_order2], &#8230;) What it means: =SORTBY(data to be sorted, by which column to sort first, [by which column to sort afterwards], &#8230;) Did you know that you can now sort your table data with an Excel [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":17794,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"cos_headline_score":0,"cos_seo_score":0,"cos_headline_text":"","cos_headline_has_been_analyzed":false,"cos_last_analyzed_headline":[],"om_disable_all_campaigns":false},"categories":[12,3,564],"tags":[142,512,565],"acf":[],"_links":{"self":[{"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/posts\/10034"}],"collection":[{"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/comments?post=10034"}],"version-history":[{"count":0,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/posts\/10034\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/media\/17794"}],"wp:attachment":[{"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/media?parent=10034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/categories?post=10034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/tags?post=10034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}