troubleshooting Question

Calculations on web page

Avatar of jlcannon
jlcannon asked on
Web DevelopmentASP
1 Comment1 Solution322 ViewsLast Modified:
Hello all. I have an HTML page that is basicaly a form page that has 2 drop down boxes and i user input textbox and the two textboxes that need to be populated from calculations. A little back story is this used to be done on an excel spreadsheet but needed to make it a web form so on the excel sheet the first two drop doens were country and then fuel type. On my webform what I did was create two dropdowns that one is Natural Gas and one is Coal and when you drop them down you get a list of countries and in the value tag of the option I list the numeric value assigned to each contry for the repected fuel medium. now the part i need help with. The textbox listed as T1 is user input but T2 and T3 are calulations. In the excel sheet the formulas we as follows:
for T2:
=IF(B4="Coal",OFFSET('CO2 Calculator'!T6,MATCH(B3,'CO2 Calculator'!T7:T157,0),1),OFFSET('CO2 Calculator'!T6,MATCH(B3,'CO2 Calculator'!T7:T157,0),2))

for T3:
=C7*C6/1000000

I will include a copy of the HTML code as well as a copy of the excel sheet to help make it more understandable since i sometimes dont explain things so well.
<html>
 
<head>
<title>CO2 Calculator</title>
</head>
 
<body>
 
<table width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td></td>
  </tr>
  <tr>
    <td><div align="left"><table border="0" cellpadding="0" cellspacing="0" width="100%">
      
      <tr>
        <td width="81%" colspan="2"><div align="left"><table name="ContentTable" id="ContentTable" border="0" cellpadding="0" cellspacing="0" width="100%">
          <tr>
            <td class="Content" name="ContentCell" id="ContentCell" valign="top" width="100%">
            
            <form name="cocalc" method="POST">
                                
                                <p class="Keyword"><table>
                                <tr><td>Natural Gas:</td><td>
                                <select name="NatGas" size="1">
<option value=0>Albania</option>
<option value=676.549>Algeria</option>
<option value=0>Angola</option>
<option value=448.0035>Argentina</option>
<option value=403.86>Armenia</option>
<option value=627.059>Australia</option>
<option value=310.014>Austria</option>
<option value=495.8877>Azerbaijan</option>
<option value=890.1022>Bahrain</option>
<option value=551.9335>Bangladesh</option>
<option value=303.325>Belarus</option>
<option value=348.377>Belgium</option>
<option value=0>Benin</option>
<option value=831.1683>Bolivia</option>
<option value=287.0178>Bosnia-Herzegovina</option> 
<option value=0>Botswana</option>
<option value=472.9333>Brazil</option>
<option value=789.0479>Brunei Darussalam</option>
<option value=235.4707>Bulgaria</option>
<option value=0>Cambodia</option>
<option value=0>Cameroon</option>
<option value=415.124>Canada</option>
<option value=423.6565>Chile</option>
<option value=305.8727>China (including Hong Kong)</option>
<option value=321.2812>People's Republic of China</option>
<option value=362.3874>Chinese Taipei</option>
<option value=534.2144>Colombia</option>
<option value=0>Congo</option>
<option value=0>Democratic Republic of Congo</option>
<option value=0>Costa Rica</option>
<option value=698.344>Côte d'Ivoire</option>
<option value=303.8167>Croatia</option>
<option value=0>Cuba</option>
<option value=0>Cyprus</option>
<option value=260.904>Czech Republic</option>
<option value=250.744>Denmark</option>
<option value=507.7778>Dominican Republic</option>
<option value=965.1165>Ecuador</option>
<option value=490.2103>Egypt</option>
<option value=0>El Salvador</option>
<option value=0>Eritrea</option>
<option value=232.6639>Estonia</option>
<option value=0>Ethiopia</option>
<option value=232.519>Finland</option>
<option value=234.721>France</option>
<option value=919.48>Gabon</option>
<option value=490.055>Georgia</option>
<option value=255.767>Germany</option>
<option value=0>Ghana</option>
<option value=0>Gibraltar</option>
<option value=459.016>Greece</option>
<option value=0>Guatemala</option>
<option value=0>Haiti</option>
<option value=0>Honduras</option>
<option value=361.5809>Hong Kong, China</option>
<option value=304.716>Hungary</option>
<option value=0>Iceland</option>
<option value=479.511>India</option>
<option value=471.7004>Indonesia</option>
<option value=525.8291>Islamic Republic of Iran</option>
<option value=0>Iraq</option>
<option value=411.714>Ireland</option>
<option value=524.4883>Israel</option>
<option value=320.764>Italy</option>
<option value=0>Jamaica</option>
<option value=448.827>Japan</option>
<option value=584.6396>Jordan</option>
<option value=585.056>Kazakhstan</option>
<option value=0>Kenya</option>
<option value=0>Dem. People's Republic of Korea</option>
<option value=342.654>Korea</option>
<option value=626.5667>Kuwait</option>
<option value=308.7886>Kyrgyzstan</option>
<option value=236.486>Latvia</option>
<option value=0>Lebanon</option>
<option value=661.97>Libya</option>
<option value=264.3421>Lithuania</option>
<option value=325.449>Luxembourg</option>
<option value=247.5409>FYR of Macedonia</option>
<option value=510.5888>Malaysia</option>
<option value=0>Malta</option>
<option value=495.287>Mexico</option>
<option value=522.5892>Republic of Moldova</option>
<option value=0>Mongolia</option>
<option value=0>Morocco</option>
<option value=724.4286>Mozambique</option>
<option value=724.9249>Myanmar</option>
<option value=0>Namibia</option>
<option value=0>Nepal</option>
<option value=281.961>Netherlands</option>
<option value=0>Netherlands Antilles</option>
<option value=419.025>New Zealand</option>
<option value=0>Nicaragua</option>
<option value=515.3616>Nigeria</option>
<option value=279.373>Norway</option>
<option value=819.1117>Oman</option>
<option value=536.5501>Pakistan</option>
<option value=0>Panama</option>
<option value=0>Paraguay</option>
<option value=906.8231>Peru</option>
<option value=368.4219>Philippines</option>
<option value=332.751>Poland</option>
<option value=336.673>Portugal</option>
<option value=617.9696>Qatar</option>
<option value=310.9166>Romania</option>
<option value=304.9916>Russia</option>
<option value=760.7881>Saudi Arabia</option>
<option value=518.7049>Senegal</option>
<option value=213.7656>Serbia and Montenegro</option>
<option value=487.7853>Singapore</option>
<option value=240.814>Slovak Republic</option>
<option value=259.7807>Slovenia</option>
<option value=803.25>South Africa</option>
<option value=319.301>Spain</option>
<option value=0>Sri Lanka</option>
<option value=0>Sudan</option>
<option value=218.576>Sweden</option>
<option value=237.847>Switzerland</option>
<option value=543.0485>Syria</option>
<option value=341.7196>Tajikistan</option>
<option value=0>United Republic of Tanzania</option>
<option value=470.6065>Thailand</option>
<option value=0>Togo</option>
<option value=711.3072>Trinidad and Tobago</option>
<option value=445.575>Tunisia</option>
<option value=357.4>Turkey</option>
<option value=795.2875>Turkmenistan</option>
<option value=302.732>Ukraine</option>
<option value=835.9345>United Arab Emirates</option>
<option value=385.859>United Kingdom</option>
<option value=437.358>United States</option>
<option value=469>Uruguay</option>
<option value=468.7281>Uzbekistan</option>
<option value=651.6397>Venezuela</option>
<option value=546.4661>Vietnam</option>
<option value=0>Yemen</option>
<option value=0>Zambia</option>
<option value=0>Zimbabwe</option>

                        </select>
                        
                        </td>
                        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
						Coal:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td><td><select name="Coal" size="1">
<option value=1708.5558>Albania</option>
<option value=930.2025>Algeria</option>
<option value=1003.6501>Angola</option>
<option value=807.7152>Argentina</option>
<option value=0>Armenia</option>
<option value=916.213>Australia</option>
<option value=392.454>Austria</option>
<option value=728.4089>Azerbaijan</option>
<option value=0>Bahrain</option>
<option value=1092.9567>Bangladesh</option>
<option value=309.8853>Belarus</option>
<option value=751.388>Belgium</option>
<option value=716.6321>Benin</option>
<option value=1276.0755>Bolivia</option>
<option value=487.4202>Bosnia-Herzegovina</option> 
<option value=1026.1667>Botswana</option>
<option value=760.1557>Brazil</option>
<option value=766.9655>Brunei Darussalam</option>
<option value=537.4099>Bulgaria</option>
<option value=1269.4007>Cambodia</option>
<option value=698.5431>Cameroon</option>
<option value=691.232>Canada</option>
<option value=714.0735>Chile</option>
<option value=683.4683>China (including Hong Kong)</option>
<option value=683.0904>People's Republic of China</option>
<option value=715.429>Chinese Taipei</option>
<option value=876.5614>Colombia</option>
<option value=0>Congo</option>
<option value=954.1304>Democratic Republic of Congo</option>
<option value=818.9225>Costa Rica</option>
<option value=635.4>Côte d'Ivoire</option>
<option value=533.7865>Croatia</option>
<option value=1012.5882>Cuba</option>
<option value=792.5048>Cyprus</option>
<option value=399.946>Czech Republic</option>
<option value=390.12>Denmark</option>
<option value=649.6242>Dominican Republic</option>
<option value=719.9548>Ecuador</option>
<option value=790.9358>Egypt</option>
<option value=618.8182>El Salvador</option>
<option value=698.5833>Eritrea</option>
<option value=397.8901>Estonia</option>
<option value=1003.4211>Ethiopia</option>
<option value=345.456>Finland</option>
<option value=530.487>France</option>
<option value=698.8916>Gabon</option>
<option value=2647.8788>Georgia</option>
<option value=717.777>Germany</option>
<option value=948.0226>Ghana</option>
<option value=743.0897>Gibraltar</option>
<option value=718.228>Greece</option>
<option value=810.6749>Guatemala</option>
<option value=587.2509>Haiti</option>
<option value=618.1187>Honduras</option>
<option value=830.5202>Hong Kong, China</option>
<option value=584.32>Hungary</option>
<option value=635.4>Iceland</option>
<option value=813.3494>India</option>
<option value=703.3333>Indonesia</option>
<option value=830.1104>Islamic Republic of Iran</option>
<option value=711.5674>Iraq</option>
<option value=744.149>Ireland</option>
<option value=647.3338>Israel</option>
<option value=473.52>Italy</option>
<option value=738.8327>Jamaica</option>
<option value=578.849>Japan</option>
<option value=772.1988>Jordan</option>
<option value=755.1836>Kazakhstan</option>
<option value=1040.4181>Kenya</option>
<option value=1378.8838>Dem. People's Republic of Korea</option>
<option value=312.384>Korea</option>
<option value=846.8746>Kuwait</option>
<option value=0>Kyrgyzstan</option>
<option value=352.3588>Latvia</option>
<option value=744.2352>Lebanon</option>
<option value=992.4332>Libya</option>
<option value=334.57>Lithuania</option>
<option value=0>Luxembourg</option>
<option value=328.2483>FYR of Macedonia</option>
<option value=724.6006>Malaysia</option>
<option value=891.8929>Malta</option>
<option value=728.067>Mexico</option>
<option value=342.4795>Republic of Moldova</option>
<option value=864.2884>Mongolia</option>
<option value=792.7109>Morocco</option>
<option value=907.8571>Mozambique</option>
<option value=735.3183>Myanmar</option>
<option value=814.2444>Namibia</option>
<option value=849.75>Nepal</option>
<option value=375.986>Netherlands</option>
<option value=717.8293>Netherlands Antilles</option>
<option value=794.25>New Zealand</option>
<option value=772.0565>Nicaragua</option>
<option value=1002.5732>Nigeria</option>
<option value=444.222>Norway</option>
<option value=1015.895>Oman</option>
<option value=692.4033>Pakistan</option>
<option value=775.5404>Panama</option>
<option value=0>Paraguay</option>
<option value=909.53>Peru</option>
<option value=688.6732>Philippines</option>
<option value=494.498>Poland</option>
<option value=602.93>Portugal</option>
<option value=0>Qatar</option>
<option value=397.3134>Romania</option>
<option value=393.7952>Russia</option>
<option value=734.8972>Saudi Arabia</option>
<option value=917.0723>Senegal</option>
<option value=1181.9468>Serbia and Montenegro</option>
<option value=707.0881>Singapore</option>
<option value=402.059>Slovak Republic</option>
<option value=467.8608>Slovenia</option>
<option value=0>South Africa</option>
<option value=698.28>Spain</option>
<option value=656.1615>Sri Lanka</option>
<option value=1212.234>Sudan</option>
<option value=331.785>Sweden</option>
<option value=368.337>Switzerland</option>
<option value=727.841>Syria</option>
<option value=0>Tajikistan</option>
<option value=1494.1484>United Republic of Tanzania</option>
<option value=729.0556>Thailand</option>
<option value=784.5221>Togo</option>
<option value=794.3333>Trinidad and Tobago</option>
<option value=959.5469>Tunisia</option>
<option value=658.381>Turkey</option>
<option value=0>Turkmenistan</option>
<option value=1084.7936>Ukraine</option>
<option value=1194.6154>United Arab Emirates</option>
<option value=574.497>United Kingdom</option>
<option value=751.117>United States</option>
<option value=820.8792>Uruguay</option>
<option value=385.3257>Uzbekistan</option>
<option value=1176.7957>Venezuela</option>
<option value=870.1865>Vietnam</option>
<option value=845.4729>Yemen</option>
<option value=847.3784>Zambia</option>
<option value=2118.2917>Zimbabwe</option>                        </select></td></tr>

<tr><td>Electricity, Heat, or Steam Purchase:(kWh)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</td>
<td><input type="text" name="T1" size="20"></td></tr>
<tr><td>CO2 emission factor:</td><td><input type="text" name="T2" size="20"></td></tr>
<tr><td>Indirect CO2 emissions:</td><td><input type="text" name="T3" size="20"></td></tr>
                        
                                <tr><td><input type="button" value="Calculate" name="B1" onClick="callallcalcs()"><input type="reset" value="Reset" name="B2"></td></tr></p>
                                </table>
                        </form>
            <p> </p>
            <hr>
            </td>
            
          </tr>
        </table>
        </div></td>
      </tr>
     
      
    </table>
    </div></td>
  </tr>
</table>
</body>
</html>
purchpower-CO2-calculator.xls
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros