Home 
Search 
Today's Posts 
#1




Integration/area under a curve VBA code?
Hi
I have built a spreadsheet that can calculate the area under a curve of a set of data but I would like to have this in VBA for Excel, in say Integral(C1,C2) format or a button on the toolbar. Can anyone point me in the right direction for acquiring the code? Cheers WayneL 
#2




Integration/area under a curve VBA code?
try this link, maybe you will find what you are looking for.ç http://www.vbnumericalmethods.com/vb...thods/math.asp cheers WAYNEL wrote: Hi I have built a spreadsheet that can calculate the area under a curve of a set of data but I would like to have this in VBA for Excel, in say Integral(C1,C2) format or a button on the toolbar. Can anyone point me in the right direction for acquiring the code? Cheers WayneL 
#3




Integration/area under a curve VBA code?
see www.stfx.ca/people/bliengme/ExcelTips
 Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "WAYNEL" wrote in message oups.com... Hi I have built a spreadsheet that can calculate the area under a curve of a set of data but I would like to have this in VBA for Excel, in say Integral(C1,C2) format or a button on the toolbar. Can anyone point me in the right direction for acquiring the code? Cheers WayneL 
#4




Integration/area under a curve VBA code?
Hi
I have a set of data that needs integrating but it does not fit an easy function therefore I need some technique (fuction) like that seen in Flex Pro. In this package you select X and Y and press a button titled "Area under Curve". This software is expensive and I am sure this could be done in Excel. Cheers WayneL P.S Some example data I am trying to find the Area Under the Curve. Seconds Voltage 0.095 4.55E04 2.526 4.14E04 4.659 3.74E04 6.791 3.45E04 8.923 3.25E04 11.055 3.11E04 13.188 3.09E04 15.321 3.05E04 17.454 2.93E04 19.587 2.86E04 21.72 2.80E04 23.855 2.76E04 25.987 2.73E04 28.119 2.70E04 30.301 2.68E04 32.433 2.66E04 34.566 2.64E04 36.698 2.62E04 38.83 2.61E04 41.172 2.60E04 43.305 2.58E04 45.436 2.57E04 47.569 2.57E04 49.702 2.56E04 51.834 2.56E04 53.966 2.56E04 56.1 2.56E04 58.233 2.56E04 60.366 2.56E04 62.499 2.55E04 64.632 2.55E04 66.772 2.55E04 68.954 2.55E04 71.086 2.55E04 73.219 2.53E04 75.357 2.54E04 77.489 2.56E04 79.621 2.55E04 81.753 2.55E04 83.884 2.55E04 86.016 2.55E04 88.149 2.55E04 90.288 2.55E04 92.42 2.55E04 94.552 2.55E04 96.684 2.55E04 98.816 2.55E04 100.949 2.56E04 103.082 2.56E04 105.214 2.56E04 107.347 2.56E04 109.549 2.55E04 111.681 2.55E04 113.813 2.54E04 115.945 2.53E04 118.077 2.53E04 120.208 2.53E04 122.341 2.53E04 124.473 2.53E04 126.605 2.53E04 128.737 2.53E04 130.87 2.53E04 133.003 2.54E04 135.136 2.54E04 137.269 2.55E04 139.401 2.53E04 141.534 2.55E04 143.666 2.57E04 145.798 2.58E04 147.93 2.59E04 150.061 2.58E04 152.193 2.59E04 154.325 2.56E04 156.457 2.57E04 158.589 2.58E04 160.723 2.57E04 162.854 2.58E04 164.986 2.60E04 167.119 2.60E04 169.251 2.61E04 171.384 2.62E04 173.517 2.63E04 175.65 2.64E04 177.785 2.67E04 179.923 2.59E04 182.055 2.59E04 184.188 2.60E04 186.327 2.60E04 188.51 2.61E04 190.649 2.60E04 192.787 2.59E04 194.918 2.60E04 197.059 2.60E04 199.2 2.60E04 201.338 2.60E04 203.476 2.61E04 205.611 2.61E04 207.744 2.62E04 209.882 2.62E04 212.02 2.63E04 214.159 2.67E04 216.292 2.65E04 218.425 2.65E04 220.557 2.65E04 222.689 2.66E04 224.821 2.66E04 226.954 2.66E04 229.094 2.67E04 231.226 2.67E04 233.359 2.66E04 235.49 2.67E04 237.622 2.67E04 239.805 2.68E04 241.938 2.69E04 244.072 2.69E04 246.204 2.70E04 248.345 2.71E04 250.478 2.71E04 252.611 2.72E04 254.744 2.73E04 256.876 2.74E04 259.009 2.75E04 261.142 2.76E04 263.274 2.75E04 265.407 2.76E04 267.539 2.76E04 269.67 2.77E04 271.802 2.77E04 273.935 2.78E04 276.355 2.79E04 278.677 2.79E04 280.937 2.81E04 283.072 2.82E04 285.205 2.83E04 287.337 2.84E04 289.47 2.84E04 291.602 2.85E04 293.743 2.86E04 296.031 2.86E04 298.163 2.87E04 300.295 2.88E04 *********************************************** "Bernard Liengme" wrote in message ... see www.stfx.ca/people/bliengme/ExcelTips  Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "WAYNEL" wrote in message oups.com... Hi I have built a spreadsheet that can calculate the area under a curve of a set of data but I would like to have this in VBA for Excel, in say Integral(C1,C2) format or a button on the toolbar. Can anyone point me in the right direction for acquiring the code? Cheers WayneL 
#5




Integration/area under a curve VBA code?
Thanks Gregory Vainberg (http://www.vbnumericalmethods.com) for this perfect
solution. I have tested it with FlexPro and the value correlates. Cheers WayneL Hey Wayne, I have a number of different methods that you can use, but the easiest technique is trapezoidal integration. On the website I have a version that takes the function name as a parameter, but it can be easily adapted to use 2 vectors as parameters as follows: Public Function TRAPnumint(x, y) As Double n = Application.Count(x) TRAPnumint = 0 For t = 2 To n TRAPnumint = TRAPnumint + 0.5 * (x(t)  x(t  1)) * (y(t  1) + y(t)) Next End Function Where x is the column of x values and y is the column of f(x) values. Hope this helps, Gregory Vainberg http://www.vbnumericalmethods.com "WayneL" wrote in message ... Hi I have built a spreadsheet that can calculate the area under a curve of a set of data but I would like to have this in VBA for Excel, in say Integral(C1,C2) format or a button on the toolbar. Can anyone point me in the right direction for acquiring the code? Cheers WayneL "WAYNEL" wrote in message oups.com... Hi I have built a spreadsheet that can calculate the area under a curve of a set of data but I would like to have this in VBA for Excel, in say Integral(C1,C2) format or a button on the toolbar. Can anyone point me in the right direction for acquiring the code? Cheers WayneL 
#6




Integration/area under a curve VBA code?
I've got the VBA code you want, cause I'm writing it. If you get to see this message then just wait a few days and I'll post it.  integreat  integreat's Profile: http://www.excelforum.com/member.php...o&userid=34282 View this thread: http://www.excelforum.com/showthread...hreadid=497266 
#7




Integration/area under a curve VBA code?
Thanks integreat

#8




Integration/area under a curve VBA code?
Thanks integreat

#9




Integration/area under a curve VBA code?
I did not get a chance to work on it today but it is VBA code that calculates a definite integral (area uder the curve) It is a simple matter to use this VBA code. I named the function "integrateTrapz" You use it just like a normal math function in excel such as SUM or ABS It will take the values ot whatever is in the cell range that you want to use as input. There is a bug in my code and I'm trying to presently get it fixed. I has been some 5 years since I have done any programming. I was an expert with Quick Basic but it seems visual basic has many changes from quick basic. Trivia The last version of quick basic came out in 1988 (v4.5)  integreat  integreat's Profile: http://www.excelforum.com/member.php...o&userid=34282 View this thread: http://www.excelforum.com/showthread...hreadid=497266 
Reply 
Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Forum  
Integration/area under a curve VBA code?  Excel Discussion (Misc queries)  
Change case...help please  Excel Worksheet Functions  
Macro for changing text to Proper Case  Excel Worksheet Functions  
Using other workbooks..  Excel Worksheet Functions  
Make Change Case in Excel a format rather than formula  Excel Worksheet Functions 