Execute w/ detect command generator for minecraft. Input entity selector, any data you want the entity searched for to have, position at which the block will be looked for, then the block itself and it's block data. Then a list will pop up and you can copy & paste from this.
Some thanks to @aidanpomid, pretty much remade it entirely tho. Could have made my own, didn't feel like it. Don't mean to be rude; thanks man. Receommended for people with some command experience.