Nếu dùng Ex2010 thì dùng UDF (hàm tự tạo) như sau:
tại ô M5:
=IF(OR(I5<>"",J5<>""),ghepCT(),"")
Kéo xuống
Với code của UDF như sau:
(Cách dùng: Atl-F11 mở VBA window, insert module, sau đó copy code này vào. Lưu file dạng .xlsm)
Option Explicit
Function GhepCT() As String
Dim r&, soP As Range...