#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 542
Default VBA ln function

I have this code that I have put together and it works fine as long as none
of my numbers are "0's" or blank cells.

'Inserts A Header and formula
Range("AU2").Select
ActiveCell.FormulaR1C1 = "A"
Range("AU3").Select
ActiveCell.FormulaR1C1 = _
"=EXP(INDEX(LINEST(LN(RC[-25]:RC[-15]),R1C22:R1C32),1,2))"

'Inserts B Header and formula
Range("AV2").Select
ActiveCell.FormulaR1C1 = "B"
Range("AV3").Select
ActiveCell.FormulaR1C1 =
"=INDEX(LINEST(LN(RC[-26]:RC[-16]),R1C22:R1C32),1)"

In my spreadsheet I have values from $V$1:$AF$1 (always constant) which are
my X values, V3:AF3 are my Y values. The formula works great as long as
there are no 0's or blank cells, I have tried to work around this in terms of
HLOOKUP and VLOOKUP but it has become more troublesome than its worth.

Is there a way to code this so that if there is a blank value that it will
ignore the 0 or blank and the coresponding X value (from $V$1:$AF$1). The
reason the formula messes up when there is a 0 or blank cell is that you
cannot take the ln(0) or a blank cell.

Thank you for your help.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Data Validation/Lookup function does function correcty Kirkey Excel Worksheet Functions 2 May 25th 09 09:22 PM
copy of excel file not showing formulal/function in the function b oaallam Excel Discussion (Misc queries) 4 September 6th 07 01:20 PM
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) [email protected] Excel Worksheet Functions 0 September 5th 06 03:44 PM
Offset function with nested match function not finding host ss. MKunert Excel Worksheet Functions 1 March 21st 06 10:46 PM
Emulate Index/Match combo function w/ VBA custom function Spencer Hutton Excel Worksheet Functions 2 May 2nd 05 05:26 PM


All times are GMT +1. The time now is 01:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"