Sum over an Interval
Jelly, 14 bytes
ḊṖVr/ḟ×ɗċⱮØ($S

A monadic Link accepting a list of characters that yields the sum of the described range.
Try it online! Or see the test-suite.
How?
ḊṖVr/ḟ×ɗċⱮØ($S - Link: list of characters, R  e.g. &quot;[5,8)&quot;
Ḋ              - dequeue                           &quot;5,8)&quot;
 Ṗ             - pop                               &quot;5,8&quot;
  V            - evaluate as Jelly                 [5,8]
                 (call that X)
            $  - last two links as a monad - f(R):
          Ø(   -   list of characters = &quot;()&quot;       &quot;()&quot;
         Ɱ     -   map across these with:
        ċ      -     count ocuurences (in R)       [0,1]
                     (call that Y)
       ɗ       - last three links as a dyad - f(X,Y):
    /          -   reduce (X) with:
   r           -     inclusive range               [5,6,7,8]
      ×        -   (X) multiply (Y) (vectorises)   [0,8]
     ḟ         -   filter discard                  [5,6,7]
             S - sum                               18