You could try encasing your T call result within wildcards

"*"&T(B6)&"*"
As you no doubt know SUMIF won't work if the target file is closed.