Pattern help re:buttonholes

Hi, fairly new to knitting (20 years since last knit!) I’ve managed to follow an figure out my pattern until now:(
I’m on the button band, my pattern reads;
Rib 5, cast off 2sts, cast off 3 times, rib 4. I have 42 sts
I tried casting off 2 sts 3times with the rib 4 in between but that didn’t work I ended up with more holes than required an odd sts at the end. Racked my brains to figure it out, can anyone help me.
Please:)

Well, if you’d like 4 buttonholes you could rib 5, cast off 2. That’ll leave you one stitch left from the cast off at the tip of the right needle. Rib 7, cast off 2, rib 7, cast off 2 etc and end rib 5 instead of rib 4. You would end up with 4 buttonholes and 8 rib sts between them with 5sts at each ends.