There's a really easy way to train Marksdwarves:
1: Fire all hunters. Hunters will screw this up.
2: Stick a bunch of unskilled dwarves in a squad of 10.
3: Arm them with wooden bolts using the military/ammunition screen.
4: Have them attack wildlife until they can reliably hit and kill - the rectangle targetting thing is very useful for this.
How this works is that live shooting is I think 3x more effective per bolt at raising skill, so it's very bolt-effecient. Unskilled dwarves are excellent at missing, misses raises XP just the same as hitting, when you have a bunch of unskilled dwarves missing a rabbit their skill skyrockets, it only takes mere minutes to raise skill level.
Once they get up to about competent they become fairly effective at hitting, at that point wildlife doesn't last that long (although wooden bolts are very poor at killing stuff, especially larger stuff), however once they are at the stage where they can quite reliably hit wildlife they will also be able to quite reliably hit invaders. You can let them resume their civilian duties now.
The reason why hunters screw this up is because they kill the animals you'd otherwise use for training. They tend to train themselves up and if you put an elite marksdwarf with 9 unskilled dwarves the elite will almost instantly terminate the animal and deprive the unskilled dwarves of their missing-based XP gain - even if he's not in the squad and just allowed to run free he'll terminate the animals you want to train on. So fire hunters.
My general experience is that melee dwarves are most effective when highly trained, 2 super-legendary melee dwarves can demolish sieges, while a couple full squads of barely trained melee dwarves just die. Otoh marksdwarves work really well in large quantities even if they aren't particularly skilled. In many of my fortresses I train every non-career military dwarf as a marksdwarf so every dwarf is armed with a crossbow and lightly armored. When sieges come everyone goes out to meet the siege and the dwarves can further work on their marksdwarf skills - live combat trains marksdwarf extremely fast.