Sorting on a metadata column

Copper Contributor

I need to be able to sort (date order) a managed metadata column in SharePoint online. Is this possible? I haven't been able to figure it out.

7 Replies
Hi
Where do you need to do the sorting? Are we talking in a web part or perhaps in a library?

@miclarsen1 

 

Thanks for responding! Where I need to sort is in a document library and the metadata column is multiple lines of text. From what I've seen, that is one of the fields you can't sort on, although I certainly don't understand why. We have been filling in descriptions, beginning with a date, hoping to use the ability to sort to create a chronology. If you have any "secret tips," I'd love to hear!

@ConnieH_456 as far as I can recall it has never been possible to sort on a managed metadata column.

 

Rob
Los Gallardos
Intranet, SharePoint, Website and Power Platform Manager (and classic 1967 Morris Traveller driver)

You can definitely sort on a managed metadata column - as long as the column does not allow you to enter multiple values. However, it looks like what you are asking about is sorting on a multiple lines of text field, which is not something you can sort on. Based on what you say you want to do, consider one of the following:
- Create a separate column with the date and sort based on that column instead of trying to add a date to the text column
- Create a calculated column to pull out the date in your multiple lines of text field and then sort on the new column. You will want to make sure your dates are all entered in a consistent format such as YYYYMMDD so that the sort will make sense and the function to create the calculated column will work.
- Could you instead sort on an existing attribute such as Modified?

@Susan Hanley 

 

Susan, thank you for your response! Here is an example of an entry in a metadata (multiple lines of text) field:  

"2018-08-27 New Order – 105 kits will arrive tomorrow"

I need to be able to sort on the date; I'm not sure how the calculated column needs to be set up to do this. So, I guess basically what I want is for the new column to pull the date into another column that I can sort on. Does that make sense? I truly appreciate your help.

Looks like you can't create a calculated column from a multiple lines of text field. If this column needs to remain multiple lines of text, I would recommend that you add a new column to enter the date that you are currently embedding in the Multiple Lines of Text field. However, if you can switch the column to be a single line of text field, you can use the following formula in your new Calculated column. Create a new column called Update Date or something like that and for the formula, type =LEFT([Column Name],10). You can actually make this a Date column by selecting Date as the type of column to be returned. Then, you will be able to sort Newest to Oldest (or vice versa) on your new Update Date column. You can continue to use the same format for entering your text and the data will be extracted into the new column. This is not going to work if you need to retain more than 255 characters in that text column, however. If what you are trying to sort on is when the row got updated last, just sort on Modified Date. You may also be able to create a flow to extract the first 10 characters and add it to a new column as well and keep the column multiple lines of text. I'm trying to answer your specific question but honestly, there may be a totally different and more effective way to accomplish your outcome goal. You may want to consider a PowerApp.
Thanks, Susan.