Basic idea
This transistor circuit of a window LED comparator is based on the following sub-devices:
voltage divider (R1, R2)
transistor comparator (Q1 or Q2)
transistor switch (Rb, Q1 or Q2)
current steering diode (D1 or D2)
The circuit resembles an RTL NOR gate with different (NPN and PNP) transistors.
The R1-R2 voltage divider (with a LED in the middle) sets the two reference (threshold) voltages and also, the LED current. The transistor comparators compare (by their base-emitter junctions) the input voltage and the respective reference voltage.
Operation
Vin = 5 V (inside the window)
The both transistor base emitter voltages are less than 0.7 V so both transistors are cut off. All the current flows through the LED and it lights up.
simulate this circuit – Schematic created using CircuitLab
Vin > 5 V (above the window)
Q1 begins turning on and connecting D1 (0.7 V) in parallel to the LED (1.5 V). Thus the LED current is gradually diverted through D1, and the LED goes out.
simulate this circuit
Vin < 5 V (below the window)
Now Q2 turns on and connects D2 in parallel to the LED. The current is diverted through D2 and the LED goes out.
simulate this circuit
All cases superimposed
simulate this circuit
More considerations
The window of 2 V can be enlarged by increasing the LED forward voltage (by changing the LED or adding more diodes in series); accordingly, the diode forward voltages must be increased.
The window can be moved up and down by changing the R1/R2 ratio.
The LED current can be adjusted by changing the sum R1 + R2.
Another version
In the circuit solution above, the two thresholds are set by two diodes put in emitters. This can be done more conveniently with only one Zener diode connected between the bases (for convenience, I have used an "ideal" diode with an adjustable forward voltage from the CircuitLab library).
simulate this circuit
Here there is more freedom to set the width of the window.
The schematic can be drawn in another form that would be more understandable for some.
simulate this circuit
In the DC Sweep simulation, I have set the "ideal" diode forward voltage as a second parameter with several values. As a result, the family of curves in the graph below was obtained.