Steve in PA's data...
In 2001, there were 61 LEO's killed feloniously by firearms. Here is the break down of distances.
Officers/distance
27 / 0-5 feet
19 / 6-10 feet
5 / 11-20 feet
5 / 21-50 feet
3 / over 50 feet
2 / not reported
Actually, these numbers don't reflect some relevant points. First, several of the officers are killed with their own guns and killed in scuffles for those guns and no doubt that comprises part of the 0-5 feet range. The other aspect is that cops are trained to use distance in their favor. The result is that many of their gun battles take place at distances greater than would be the case for normal non-leo situations such as where somebody was trying to rob you. So even though the LEO data shows a lot a fairly close range, for non-leos, the percentages at closer range are probably greater.
Several folks here have mentioned gunfights. If they are using gunfight data, the data will be skewed. A lot of folks killed while being robbed end up as the victim of a shooting and not the victim of a gun fight. The difference is a little overly specific, but valid. The victims either did not have a gun, were not able to access the gun, or never managed to use the gun in defense. Bad guys feel comfortable being closer to folks they believe don't have weapons than to folks that do have weapons.