Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

103
Vistas
Is there any problem with converting this excel formula to javascript?

Here is the excel formula:

=E2-(J2*2*G2)-(K2*E2*2)/30+IF((L2+M2)>60,((L2+M2)-60)*H2+60*G2,(L2+M2)*G2)+(N2/$AE$1)*$AE$2+(Q2*$AE$5+P2*$AE$4+O2*$AE$3)

Here what I tried (Javascript):

                    var E2 = $("#sentence").val();
                    var J2 = $("#deduction").val();
                    var G2 = 55145;
                    var K2 = $("#absence").val();
                    var L2 = $("#overtime").val();
                    var M2 = 0;
                    var H2 = 50050;
                    var N2 = $("#transportation").val();
                    var sixty;

                if ((L2 + M2) > 60) {
                    sixty = ((L2 + M2) - 60) * H2 + 60 * G2;
                } else {
                    sixty = (L2 + M2) * G2;
                };

                var result = E2 - (J2 * 2 * G2) - (K2 * E2 * 2) / 30 + sixty;

I couldn't find the way to conver this part of formula:

+(N2/$AE$1)*$AE$2+(Q2*$AE$5+P2*$AE$4+O2*$AE$3)

Here I found the problem:

Even if one of the variables sets to null, then the formula does not work properly.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It looks like some pretty basic math.

let total = (N2 / AE1) * AE2 + (Q2 * AE5 + P2 * AE4 + O2 * AE3 )

This is basically impossible to translate without seeing the actual spreadsheet but that should get you started. Also, make sure to take into consideration order of operations because the computer is going to evaluate it from left to right unless there are parenthesis (where it will evaluate those first).

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda