Forum Discussion
ConnieH_456
Jun 16, 2021Copper Contributor
Sorting on a metadata column
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.
SusanHanley
Jun 18, 2021MVP
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?
- 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?
- ConnieH_456Jun 18, 2021Copper Contributor
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.
- SusanHanleyJun 18, 2021MVPLooks 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.
- ConnieH_456Jun 18, 2021Copper ContributorThanks, Susan.