Solved

How to code mathematical function "ln" in VB?

Posted on 2003-12-03
Medium Priority
3,866 Views
Hi experts,
I want to write a formula in VB and my formula contain mathematical function "ln" .. i just don't know how to code it in VB..
i know for "log".. just put something like log(2).. but cannot with "ln"..

thanks
0
Question by:michelle_branch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 2

Expert Comment

ID: 9865369
In is a reserved word in VB + SQL
Can you give an example of what context you wish to use it?
0

LVL 7

Accepted Solution

_agj_ earned 120 total points
ID: 9865752
ln is natural log.

log() fn in vb is natural log itself.

so u can use it.

if u want log to the base 10, do a log(x)/log(10)
0

LVL 1

Expert Comment

ID: 9866048
log is ln in VB.

log(e)=1
0

Expert Comment

ID: 9869068
The closest thing to IN would be a case statement

select case (val)
case  1 to 15: do something
case 20,30,40,50: do something else
case else:  not "IN" above"
end select

I know it's not exactly math, but it works as a replacemet.
ie "IF x in {1,5,34,34,36 } can translate to

if x = 1  or x=5 or x=34 or x=36 then
do something
end if

(or)

select case x
case 1,5,34,34,36 : do something

hope that helps!
0

Expert Comment

ID: 9869142
The closest thing to IN would be a case statement

select case (val)
case  1 to 15: do something
case 20,30,40,50: do something else
case else:  not "IN" above"
end select

I know it's not exactly math, but it works as a replacemet.
ie "IF x in {1,5,34,34,36 } can translate to

if x = 1  or x=5 or x=34 or x=36 then
do something
end if

(or)

select case x
case 1,5,34,34,36 : do something
end select

hope that helps!
0

LVL 7

Expert Comment

ID: 9873016
no spec. grudges, but why did u opt for grade B.?
as in, i thot the answer was total.
0

Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month13 days, 7 hours left to enroll