calculate index using <=, not match