Reference cell in Averageif criteria not working

I used the formula
=AVERAGEIF(‘m-1’.E:E,"&B6&",‘m-1’.I:I)

range e:e in the sheet m-1 has multiple values , out of which I check with the value i enter in b6. When I enter the actual string in the criteria instead of referencing then the function works fine but when I reference it to b6 it shows me a div/0 error.

String matches are exact, I get the same issue even if I use. * in criteria

Please help me out on how to solve it

What do you mean by "&B6&"?

I suppose that you want something like this:

=AVERAGEIF('m-1'.E:E,B6,'m-1'.I:I)