#NULL! happens when you use the intersection operator (a space) between ranges that don't actually overlap, or miss a comma between arguments.
Fix the operator
Use a comma for union (A1:A5,B1:B5) or a colon for a range (A1:B5).
It's the intersection operator — it returns cells common to both ranges, and #NULL! if there are none.