# Case function with field greater than a number but lower than another number

Discussion created by manuelruizga on Apr 24, 2017
Latest reply on Apr 27, 2017 by manuelruizga

I have set a calculation field called "retraso_horas" which calculates the elapsed time between two dates and hours which are also set in 4 different fields. It works just fine. For example, it shows 3 when the elapsed time has been 3 hours. This is the function used (The result is shown as "Time"):

Now, I am building a case function in another field so that, in one of the cases, if the elapsed time is equal or greater than 3 hours but lower than 4 hours, then show something. Yet, it seems like it is not working well. In particular, it does not work well with the last two cases, "case 5 and case 6". It will show only "300", even when "retraso_horas" is greater than 4 hours. I think it is only taking into account (retraso_horas  ≥  3). This is how I have set it:

Case (

//CASE 1//

(extracomunitarios = "intracomunitarios") and (rango_distancia = "menos de 1.500km") and (retraso_horas  ≥  3); 250;

//CASE 2//

(extracomunitarios = "intracomunitarios") and (rango_distancia = "más de 1.500km dentro de la EU") and (retraso_horas  ≥  3); 400;

/CASE 3//

(extracomunitarios = "extracomunitarios") and (rango_distancia = "menos de 1.500km") and (retraso_horas  ≥  3); 250;

//CASE 4//

(extracomunitarios = "extracomunitarios") and (rango_distancia = "entre 1.500 - 3.500km") and (retraso_horas  ≥  3); 400;

//CASE 5//

((extracomunitarios = "extracomunitarios") and (rango_distancia = "más de 3.500km") and (3 ≤ retraso_horas < 4)); 300;

//CASE 6//

((extracomunitarios = "extracomunitarios") and (rango_distancia = "más de 3.500km") and ( retraso_horas  ≥  4)); 600;

)

Is there anything wrong I am missing?

Thank you in advance.