How to sort or filter data by strikethrough in Excel?
In Excel, we often format the data with strikethrough to indicate the items are no longer required. And sometimes, we need to filter or sort the data which containing the strikethrough, so that we can quickly deal with these rows. Is there any quick tricks for us to sort or filter the data by strikethrough?
Unfortunately, there is no direct way for us to sort or filter the strikethrough data by using Sort or Filter function, but, we can create a simple User Defined Function to mark the data with strikethrough first, and then apply the sort or filter feature.
Supposing I have the following range of data with strikethrough as screenshot shown, you can sort or filter the strikethrough data with following steps:
1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and paste the following code in the Module Window.
Function HasStrike(Rng As Range) As Boolean HasStrike = Rng.Font.Strikethrough End Function
3. Then save and close this the window, in a blank cell beside your data, please enter this formula =HasStrike(A2), in this case, I will enter it to cell C2. See screenshot:
Note: In the above formula, A2 is the value that you need to identify if it is formatted as strikethrough. You can change it as your need.
4. Then drag the fill handle over to the cells that you want to apply this formula. As the following screenshot shown, you can see, if the data is formatted as strikethrough, it is displayed as TRUE, and the normal data is displayed as FALSE.
5. Then you can sort or filter by this new column C.
A: Sort the strikethrough data at bottom or top of the records:
(1.) Click Data > Sort, see screenshot:
(2.) Then in the popped out Sort Warning dialog, check Expand the selection option.
(3.) And click Sort button, in the Sort dialog box, choose Column C which is your new created column from Column drop down list, and then choose Values under the Sort On option, finally select the Order you would like to sort. See screenshot:
(4.) Then click OK to close this dialog, and the strikethrough data has been sorted at the bottom of the value. See screenshot:
Tip: If you want to sort the strikethrough data to the top of all the data, you just choose Largest to Smallest in step 3.
B: Filter the records by strikethrough
(1.) Select your whole data range, here I select range A1 : C14, and click Data > Filter, see screenshot:
(2.) Then click the drop down button beside cell C1, and then just check TRUE option only, see screenshot:
(3.) Then click OK, and all the strikethrough data has been filtered.
Note: After finishing the sort and filter, you can delete the value in Column C.
If you have Kutools for Excel, with its Filter Strikethrough feature, you can quickly filter all cells which are formated as strikethrough.
After installing Kutools for Excel, please do as this:
1. Select the column that you want to filter cells with strikethrough, and then click Kutools Plus > Special Filter > Filter Strikethrough, see screenshot:
2. And then, a prompt box will pop out to remind you how many cells are matched witht the criteria, see screenshot:
3. Then click OK button, all cells which are formated with strikethrough are filtered out, see screenshot: