IB 5389 then IB 418 at Barcelona
Bari → Barcelona → Madrid
Timetable, Barcelona time
23:20IB 5389 from Bari at the gatealso LL 5389, VY 6113
18:00IB 418 to Madrid leaves the gatealso IB 418S, LA 1585, CX 1836, LL 3018, VY 5082, AV 6019, QR 6562
18 h 40 apart on the timetable, overnight
IB 418 leaves 18 h 40 after IB 5389 arrives on the timetable: more than half a day, so not a connection we count.