A fretboard diagram to show the chord formula in action using the notes from the C Major scale.
Take the 1st, then the 3rd and finally, the 5th note from the scale. That would be C, E, and G:
Those three notes make up the C chord.
Do the same thing starting from F, that would be F, A, C. G would be G, B, D....