Magento Grid Block has useful function for advanced filtering of a collection. It is called ‘filter_condition_callback’, and it is used in declaring a column. It takes actual collection, and callback function as parameters.

Major elements:

and:

All Code: