Do you know any custom function that rounds up (like the Ceiling function) a number according to a list of numbers?

Something like this:

RoundCF ( theList ; theValue )

RoundCF ( 2 ¶ 3.5 ¶ 7.2 ¶ 15 ; 4 ) returns 7.2

RoundCF ( 2 ¶ 3.5 ¶ 7.2 ¶ 15 ; 7.3 ) returns 15

Thanks!

I'm not sure how "round up" should produce a number with a decimal part …what you mean is: return the next larger element from the list?!

Assuming theList is pre-sorted, try

// FindLargerInList ( theList ; theValue ) =

Let ( [

first = GetAsNumber ( GetValue ( theList ; 1 ) ) ;

last = GetAsNumber ( RightValues ( theList ; 1 ) ) ;

v = theValue

] ;

Case (

v >= last ; v ;

first > v ; first ;

FindLargerInList ( RightValues ( theList ; ValueCount ( theList ) - 1 ) ; v )

)

)