# asof {#asof}

**Parent topic:**[Functions](../../Functions/category.md)

## Syntax {#syntax}

`asof(X, Y)`

## Arguments {#arguments}

**X** must be a vector/indexed series/indexed matrix sorted in ascending order.

**Y** is a scalar/vector/tuple/matrix/dictionary/table/array vector.

## Details {#details}

For each element y in *Y*, return the index of the last element in *X* that is no greater than y. If nothing is found, return -1.

## Examples {#examples}

```
asof(1..100, 60 200 -10)
// output: [59,99,-1]

0 0 0 1 1 1 1 2 2 3 asof 1
// output: 6
```

