Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default My equation is too long!

I am populating a table with equations. However, some of them are too long.
I can type them in manually (and they work), so I know the equation is OK.
What can I do?


Selection.FormulaArray = _
"=SUM(IF(('DIMS Data (2)'!R1C1:R6992C[-2]=""MAG DEV TLP RIG
MOB"")*('DIMS Data (2)'!R1C8:R6992C[5]=" & PN & ")*('DIMS Data
(2)'!$I$1:$I$6992='RISER'),'DIMS Data (2)'!R1C6:R6992C[3]))"


That is only two lines of code
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default My equation is too long!


"OkieViking" wrote in message
...
I am populating a table with equations. However, some of them are too

long.
I can type them in manually (and they work), so I know the equation is OK.
What can I do?


Selection.FormulaArray = _
"=SUM(IF(('DIMS Data (2)'!R1C1:R6992C[-2]=""MAG DEV TLP RIG
MOB"")*('DIMS Data (2)'!R1C8:R6992C[5]=" & PN & ")*('DIMS Data
(2)'!$I$1:$I$6992='RISER'),'DIMS Data (2)'!R1C6:R6992C[3]))"


That is only two lines of code


I don't understand. If you can enter the formula manually, how can it be too
long?
/Fredrik


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default My equation is too long!

Fredrik,

I can type it into the spreadsheet. However, I want a macro to enter it
into the spreadsheet.

Selection.FormulaArray = _
"=SUM(IF(('DIMS Data (2)'!R1C1:R6992C[-2]=""MAG DEV TLP RIG
MOB"")*('DIMS Data (2)'!R1C8:R6992C[5]=" & PN & "),'DIMS Data (2)'
!R1C6:R6992C[3]))"

works in VBA. However the line below doesn't. It gets error messages.

Selection.FormulaArray = _
"=SUM(IF(('DIMS Data (2)'!R1C1:R6992C[-2]=""MAG DEV TLP RIG
MOB"")*('DIMS Data (2)'!R1C8:R6992C[5]=" & PN & ")*('DIMS Data
(2)'!$I$1:$I$6992='RISER'),'DIMS Data (2)'!R1C6:R6992C[3]))"


"Fredrik Wahlgren" wrote:


"OkieViking" wrote in message
...
I am populating a table with equations. However, some of them are too

long.
I can type them in manually (and they work), so I know the equation is OK.
What can I do?


Selection.FormulaArray = _
"=SUM(IF(('DIMS Data (2)'!R1C1:R6992C[-2]=""MAG DEV TLP RIG
MOB"")*('DIMS Data (2)'!R1C8:R6992C[5]=" & PN & ")*('DIMS Data
(2)'!$I$1:$I$6992='RISER'),'DIMS Data (2)'!R1C6:R6992C[3]))"


That is only two lines of code


I don't understand. If you can enter the formula manually, how can it be too
long?
/Fredrik



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default My equation is too long!

for FormulaArray property, I believe the limit is 255 characters. Manually,
the limit is 1024 characters.

--
Regards,
Tom Ogilvy

"OkieViking" wrote in message
...
I am populating a table with equations. However, some of them are too

long.
I can type them in manually (and they work), so I know the equation is OK.
What can I do?


Selection.FormulaArray = _
"=SUM(IF(('DIMS Data (2)'!R1C1:R6992C[-2]=""MAG DEV TLP RIG
MOB"")*('DIMS Data (2)'!R1C8:R6992C[5]=" & PN & ")*('DIMS Data
(2)'!$I$1:$I$6992='RISER'),'DIMS Data (2)'!R1C6:R6992C[3]))"


That is only two lines of code



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default My equation is too long!


"Tom Ogilvy" wrote in message
...
for FormulaArray property, I believe the limit is 255 characters.

Manually,
the limit is 1024 characters.

--
Regards,
Tom Ogilvy


Interesting, I didn't know that. Okie, have you tried to catch the exception
message?

/Fredrik




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default My equation is too long!

Thanks Tom,

The equation is only 181 characters long if I count correctly (within the
quotation marks). Is there a column width limitation in VBA editor? The
equation stretches out into column 192 right now. And if so, where could I
insert the " _" continuation mark to make it continue onto the next line.

"Tom Ogilvy" wrote:

for FormulaArray property, I believe the limit is 255 characters. Manually,
the limit is 1024 characters.

--
Regards,
Tom Ogilvy

"OkieViking" wrote in message
...
I am populating a table with equations. However, some of them are too

long.
I can type them in manually (and they work), so I know the equation is OK.
What can I do?


Selection.FormulaArray = _
"=SUM(IF(('DIMS Data (2)'!R1C1:R6992C[-2]=""MAG DEV TLP RIG
MOB"")*('DIMS Data (2)'!R1C8:R6992C[5]=" & PN & ")*('DIMS Data
(2)'!$I$1:$I$6992='RISER'),'DIMS Data (2)'!R1C6:R6992C[3]))"


That is only two lines of code




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default My equation is too long!

The error message I get is: "Run-time error '1004':
Unable to set the FormulaArray property of the Range class
"Tom Ogilvy" wrote:

for FormulaArray property, I believe the limit is 255 characters. Manually,
the limit is 1024 characters.

--
Regards,
Tom Ogilvy

"OkieViking" wrote in message
...
I am populating a table with equations. However, some of them are too

long.
I can type them in manually (and they work), so I know the equation is OK.
What can I do?


Selection.FormulaArray = _
"=SUM(IF(('DIMS Data (2)'!R1C1:R6992C[-2]=""MAG DEV TLP RIG
MOB"")*('DIMS Data (2)'!R1C8:R6992C[5]=" & PN & ")*('DIMS Data
(2)'!$I$1:$I$6992='RISER'),'DIMS Data (2)'!R1C6:R6992C[3]))"


That is only two lines of code




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default My equation is too long!

MVP Dick Kusleika's website had a simple solution to
overcoming this problem. You can see at:

http://www.dicks-blog.com/archives/2005/01/10/entering-
long-array-formulas-in-vba/

HTH
Jason
Atlanta, GA

-----Original Message-----
I am populating a table with equations. However, some of

them are too long.
I can type them in manually (and they work), so I know

the equation is OK.
What can I do?


Selection.FormulaArray = _
"=SUM(IF(('DIMS Data (2)'!R1C1:R6992C[-2]=""MAG

DEV TLP RIG
MOB"")*('DIMS Data (2)'!R1C8:R6992C[5]=" & PN & ")*('DIMS

Data
(2)'!$I$1:$I$6992='RISER'),'DIMS Data (2)'!R1C6:R6992C

[3]))"


That is only two lines of code
.

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default My equation is too long!

sStr = "=SUM(IF(('DIMS Data (2)'!R1C1:R6992C[-2]=""MAG DEV TLP RIG
MOB"")*('DIMS Data (2)'!R1C8:R6992C[5]=" & PN & ")*('DIMS Data
(2)'!$I$1:$I$6992='RISER'),'DIMS Data (2)'!R1C6:R6992C[3]))"
? len(sStr)
169
? sStr
=SUM(IF(('DIMS Data (2)'!R1C1:R6992C[-2]="MAG DEV TLP RIG MOB")*('DIMS Data
(2)'!R1C8:R6992C[5]=)*('DIMS Data (2)'!
$I$1:$I$6992='RISER'),'DIMS Data (2)'!R1C6:R6992C[3]))

if you look at the last part, you can see that this isn't a legal formula.
RISER has single quotes around it, you have an =)

So you have more work to do to get the formula correct. I suggest you enter
the formula in a cell, select the cell, then go to the immediate window and
do
? activeCell.FormulaR1C1

This should give you the string you need.

--
Regards,
Tom Ogilvy



"OkieViking" wrote in message
...
Thanks Tom,

The equation is only 181 characters long if I count correctly (within the
quotation marks). Is there a column width limitation in VBA editor? The
equation stretches out into column 192 right now. And if so, where could

I
insert the " _" continuation mark to make it continue onto the next line.

"Tom Ogilvy" wrote:

for FormulaArray property, I believe the limit is 255 characters.

Manually,
the limit is 1024 characters.

--
Regards,
Tom Ogilvy

"OkieViking" wrote in message
...
I am populating a table with equations. However, some of them are too

long.
I can type them in manually (and they work), so I know the equation is

OK.
What can I do?


Selection.FormulaArray = _
"=SUM(IF(('DIMS Data (2)'!R1C1:R6992C[-2]=""MAG DEV TLP RIG
MOB"")*('DIMS Data (2)'!R1C8:R6992C[5]=" & PN & ")*('DIMS Data
(2)'!$I$1:$I$6992='RISER'),'DIMS Data (2)'!R1C6:R6992C[3]))"


That is only two lines of code






  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default My equation is too long!

I just figured out my problem. Through editing I had ended up with both
range types in the same equation (R1C1 and A1). It works now.

Thanks guys.

Thanks Jason. I will check out the web site.



"Jason Morin" wrote:

MVP Dick Kusleika's website had a simple solution to
overcoming this problem. You can see at:

http://www.dicks-blog.com/archives/2005/01/10/entering-
long-array-formulas-in-vba/

HTH
Jason
Atlanta, GA

-----Original Message-----
I am populating a table with equations. However, some of

them are too long.
I can type them in manually (and they work), so I know

the equation is OK.
What can I do?


Selection.FormulaArray = _
"=SUM(IF(('DIMS Data (2)'!R1C1:R6992C[-2]=""MAG

DEV TLP RIG
MOB"")*('DIMS Data (2)'!R1C8:R6992C[5]=" & PN & ")*('DIMS

Data
(2)'!$I$1:$I$6992='RISER'),'DIMS Data (2)'!R1C6:R6992C

[3]))"


That is only two lines of code
.




  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default My equation is too long!

Excellent!

/Fredrik

"OkieViking" wrote in message
...
I just figured out my problem. Through editing I had ended up with both
range types in the same equation (R1C1 and A1). It works now.

Thanks guys.

Thanks Jason. I will check out the web site.



"Jason Morin" wrote:

MVP Dick Kusleika's website had a simple solution to
overcoming this problem. You can see at:

http://www.dicks-blog.com/archives/2005/01/10/entering-
long-array-formulas-in-vba/

HTH
Jason
Atlanta, GA

-----Original Message-----
I am populating a table with equations. However, some of

them are too long.
I can type them in manually (and they work), so I know

the equation is OK.
What can I do?


Selection.FormulaArray = _
"=SUM(IF(('DIMS Data (2)'!R1C1:R6992C[-2]=""MAG

DEV TLP RIG
MOB"")*('DIMS Data (2)'!R1C8:R6992C[5]=" & PN & ")*('DIMS

Data
(2)'!$I$1:$I$6992='RISER'),'DIMS Data (2)'!R1C6:R6992C

[3]))"


That is only two lines of code
.




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
http://CannotDeleteFile.net - Cannot Delete File? Try Long Path ToolFilename is too long? Computer Complaining Your Filename Is Too Long? TheLong Path Tool Can Help While most people can go about their businessblissfully unaware of the Windo Max Loger Excel Discussion (Misc queries) 0 June 14th 11 04:30 PM
Long Long Long Nested If Function sed Excel Discussion (Misc queries) 4 December 9th 09 06:44 PM
Clearing cells takes long, long time unclemuffin Excel Discussion (Misc queries) 9 August 17th 07 02:22 AM
Equation Editor- problem when editing an equation Gaby L. Excel Discussion (Misc queries) 0 September 27th 05 09:24 PM
I have a long equation which I need to repeat 16 times! CC-Khriz Excel Worksheet Functions 1 June 28th 05 05:01 PM


All times are GMT +1. The time now is 02:01 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"