Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: If statement in Javascript  (Read 6223 times)

SandroSferrazza

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 2
If statement in Javascript
« on: March 29, 2019, 08:07:38 AM »

Hi, I am new to this forum and very new to javascript. We are trying to make an easier process for the company to receive material pricing from our suppliers. At the moment, we receive hand written garbage that is quoted in either price per pound, price per foot, or each.
I am trying to create an easy to use form to eliminate all the extra calculation work.
I tried to attach an excel file that does EXACTLY what I am looking to do but it wont let me. I attached a pdf of the excel sheet to try to explain what it does The "Total" column has this code in it..
=IF(H3="PER FOOT",G3*E3*A3,IF(H3="PER POUND",G3*F3*A3,G3*A3))

Basically all I am trying to do is convert different pricing back in a price per piece (EACH PRICE). Simple calculations between cells is no problem, just the "if" code.

The only thing I need help with is coming up with a code that will do this. I am familiar with coding but have never touched javascript and for the simplicity of this code I was hoping somebody could just help me instead of going through hours of learning.
Please have a look at the attached filed and if anyone can help it would be extremely appreciated!

Thanks
Sandro
Logged

Guilty-Ham

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 36
Re: If statement in Javascript
« Reply #1 on: April 01, 2019, 07:47:18 AM »

Why not just sent the excel sheet and lock the formula cells?  Highlight the cells that need to be filled by the supplier.  This would be better in the long run so if you want to adjust the quantities it is a simpler task.   Plus then in excel you can use the comparison functions to see who is lowest and is much easier to import to your summary.
Logged

SandroSferrazza

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 2
Re: If statement in Javascript
« Reply #2 on: April 01, 2019, 08:20:48 AM »

Hi, Thanks for replying. I agree with you it would be alot easier for me to keep it in an excel file for multiple reasons. Unfortunately, this sheet will end up being used by everybody in the company, many of which do not have excel. The suppliers may also not have excel. The most widely accepted format is pdf and we currently use a pdf form right now but with minimal functionality.

If you know how to do the coding for basically one simple "if" statement please let me know!
Logged