Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All,
Do somebody know a simple user function converting calulated resisto value to nearest E12 standard one. Thaks in advance:confused -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Guys
After very useful help advices I realize I have to do it myself. Former Basic user, never build any code this is wath I have done. Enjoy. Function CnvSt(InVal As Double) ' My DIY function converting any calculated value capacitor ' or resistor to standard E12 row value Dim A As Variant, Ras, K, CntM, CntD Ras = 10000000000#: ContM = 0: CountD = 0 A = Array(1, 1.2, 1.5, 1.8 , 2.2, 2.7, 3.3, 4.7, 5.6, 6.8, 8.2) InValM = InVal: 'for numbers over 10 If InVal 10 Then Do While InValM 10 InValM = InValM / 10 CntM = CntM + 1 Loop End If ' for numbers below 1 If InVal < 1 Then Do While InValM < 1 InValM = InValM * 10 CntD = CntD + 1 Loop End If For j = 0 To 10 If Abs(InValM - A(j)) < Ras Then Ras = Abs(InValM - A(j)) K = j End If Next j OpVal = A(K) * 10 ^ (CntM) * 10 ^ ((-1) * CntD) CnvSt = OpVal End Functio -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Conversion help | Excel Worksheet Functions | |||
Day Conversion | Excel Worksheet Functions | |||
Between conversion | Excel Worksheet Functions | |||
Conversion | Excel Worksheet Functions | |||
XML Conversion | Excel Programming |