Within sensible limits, it is to do with ratios.
Wheel size. Every rotation of the wheel makes you move across the ground by a distance equal to one circumference of your wheel.
Therefore, if you double the size of your wheel, you double how far you travel per revolution.
So if you add 10% to the size of your wheel, you travel 10% further per revolution.
Therefore, all other things being equal, and pedalling at the same cadence (rpm) a 26 will travel 26/24 times as fast as a 24.
26/24 = 1.08333, so a 26 is 8% faster than a 24.
However, all other things are not equal. A bigger wheel will be smoother, and be less affected by minor changes in the surface you are riding over.
A similar ratio thing works with cranks, but only within a fairly narrow range. Add 10% to your cranks and you get 10% more leverage, but your feet have to travel 10% further per revolution, so you tend to pedal slightly more slowly.
However, common sense tells you that you would not go incredibly fast on 10 mm cranks, and you would not do very well on a 36 with 400mm cranks either.
The wheel size ratio effect is fairly consistent as long as you are a confident rider, although big wheels will always go slightly faster than the maths suggests.
The crank size ratio effect is much more dependant on your skill, confidence, leg length, etc.
The only way to find out is to try. As you do more miles, you will find that there are one or two crank sizes that suit you best, and you will find a wheel size that suits you best for the sort of riding you like to do.
You cannot just reduce it to arithmetic, and you cannot learn more than the very basic principles from someone else’s experience.