look on user manuals of the board your looking to buy and in specification page you will always find something like this (quoted from Asus Z170 Gaming Pro Manual located at https://www.manualslib.com/a/asus+z170+pro+gaming.html)
4 x DIMM, maximum 64 GB, DDR4 3400(O.C.)*/3333(O.C.)*/3200(O.C.)*/
3100(O.C.)*/3000(O.C.)*/2933(O.C.)*/2800(O.C.)*/2666(O.C.)*/2600(O.C.)*/
2400(O.C.)*/2133 MHz, non-ECC, un-buffered memory
you see this is a 3400mhz all the way down to 2133mhz
you need to find a board that lists the memory TYPE (DDR3 or DDR4) and speed you have on hand.
upgrading is what will the board support from that point.