#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 205
Default cell with formula

Hi!
how to set a formula to cell using macro?i dont want to type the formula in
the particular cell since i face problem to create chart from the data.
here's the formula:
=SUMPRODUCT((TRIM(Sheet1!$A$1:$A$100)=TRIM($A2))*( TRIM(Sheet1!$B$1:$B$100)=TRIM(B$1)))
and i need to copy the formula across 50R*50C.
Thanks!
--
Regards,
Linda
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 19
Default cell with formula

On 19 Sep, 09:32, linda wrote:
Hi!
how to set a formula to cell using macro?i dont want to type the formula in
the particular cell since i face problem to create chart from the data.
here's the formula:
=SUMPRODUCT((TRIM(Sheet1!$A$1:$A$100)=TRIM($A2))*( TRIM(Sheet1!$B$1:$B$100)=*TRIM(B$1)))
and i need to copy the formula across 50R*50C.
Thanks!
--
Regards,
Linda


Why dont you place your formula in a area away from where you want to
chart.
Then copy the result from your formula and paste special to the cell
where you want to chart from?
Maybe create your formula in another sheet in your workbook?
Does thathelp?
Mark


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 205
Default cell with formula

i've done that already but the chart still include the data which the formula
returns zero.what i'm doing right now is copy the value of cell via macro to
another area for me to create the chart but its running too slow.sometimes,it
takes hours.
this is my macro:
Do While Cells(a, b).Value < ""
x = a
Do While Cells(x, b).Value < ""
Cells(x, y).Value = Cells(x, b).Value
x = x + 1
Loop
b = b + 1
y = y + 1
Loop
--
Regards,
Linda


" wrote:

On 19 Sep, 09:32, linda wrote:
Hi!
how to set a formula to cell using macro?i dont want to type the formula in
the particular cell since i face problem to create chart from the data.
here's the formula:
=SUMPRODUCT((TRIM(Sheet1!$A$1:$A$100)=TRIM($A2))*( TRIM(Sheet1!$B$1:$B$100)=-TRIM(B$1)))
and i need to copy the formula across 50R*50C.
Thanks!
--
Regards,
Linda


Why dont you place your formula in a area away from where you want to
chart.
Then copy the result from your formula and paste special to the cell
where you want to chart from?
Maybe create your formula in another sheet in your workbook?
Does thathelp?
Mark



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default cell with formula

Maybe you could just use another formula to retrieve those values from that
other range:

=if(somecell=0,na(),somecell)
like
=if(sheet99!A1=0,na(),sheet99!a1)

The na()'s won't appear on your chart, but will "clutter" up your table. You
may want to use Format|Conditional formatting to hide those errors.



linda wrote:

i've done that already but the chart still include the data which the formula
returns zero.what i'm doing right now is copy the value of cell via macro to
another area for me to create the chart but its running too slow.sometimes,it
takes hours.
this is my macro:
Do While Cells(a, b).Value < ""
x = a
Do While Cells(x, b).Value < ""
Cells(x, y).Value = Cells(x, b).Value
x = x + 1
Loop
b = b + 1
y = y + 1
Loop
--
Regards,
Linda

" wrote:

On 19 Sep, 09:32, linda wrote:
Hi!
how to set a formula to cell using macro?i dont want to type the formula in
the particular cell since i face problem to create chart from the data.
here's the formula:
=SUMPRODUCT((TRIM(Sheet1!$A$1:$A$100)=TRIM($A2))*( TRIM(Sheet1!$B$1:$B$100)=-TRIM(B$1)))
and i need to copy the formula across 50R*50C.
Thanks!
--
Regards,
Linda


Why dont you place your formula in a area away from where you want to
chart.
Then copy the result from your formula and paste special to the cell
where you want to chart from?
Maybe create your formula in another sheet in your workbook?
Does thathelp?
Mark




--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default cell with formula

If you really want a macro, how about:

copy the entire range
paste as values
select that pasted range
edit|replace
what: 0 (match entire cell contents!)
with: (leave blank)
replace all

linda wrote:

i've done that already but the chart still include the data which the formula
returns zero.what i'm doing right now is copy the value of cell via macro to
another area for me to create the chart but its running too slow.sometimes,it
takes hours.
this is my macro:
Do While Cells(a, b).Value < ""
x = a
Do While Cells(x, b).Value < ""
Cells(x, y).Value = Cells(x, b).Value
x = x + 1
Loop
b = b + 1
y = y + 1
Loop
--
Regards,
Linda

" wrote:

On 19 Sep, 09:32, linda wrote:
Hi!
how to set a formula to cell using macro?i dont want to type the formula in
the particular cell since i face problem to create chart from the data.
here's the formula:
=SUMPRODUCT((TRIM(Sheet1!$A$1:$A$100)=TRIM($A2))*( TRIM(Sheet1!$B$1:$B$100)=-TRIM(B$1)))
and i need to copy the formula across 50R*50C.
Thanks!
--
Regards,
Linda


Why dont you place your formula in a area away from where you want to
chart.
Then copy the result from your formula and paste special to the cell
where you want to chart from?
Maybe create your formula in another sheet in your workbook?
Does thathelp?
Mark




--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 205
Default cell with formula

thanks for reply Dave,
but i already tried both of your suggestion and both dont work.na() still
include in charts.and if i copy & replace,its still charting the empty cell
that include in the entire range.
thats why i have to copy the value from cell to cell,but then its running
too slow.
is there any other ways?
--
Regards,
Linda


"Dave Peterson" wrote:

If you really want a macro, how about:

copy the entire range
paste as values
select that pasted range
edit|replace
what: 0 (match entire cell contents!)
with: (leave blank)
replace all

linda wrote:

i've done that already but the chart still include the data which the formula
returns zero.what i'm doing right now is copy the value of cell via macro to
another area for me to create the chart but its running too slow.sometimes,it
takes hours.
this is my macro:
Do While Cells(a, b).Value < ""
x = a
Do While Cells(x, b).Value < ""
Cells(x, y).Value = Cells(x, b).Value
x = x + 1
Loop
b = b + 1
y = y + 1
Loop
--
Regards,
Linda

" wrote:

On 19 Sep, 09:32, linda wrote:
Hi!
how to set a formula to cell using macro?i dont want to type the formula in
the particular cell since i face problem to create chart from the data.
here's the formula:
=SUMPRODUCT((TRIM(Sheet1!$A$1:$A$100)=TRIM($A2))*( TRIM(Sheet1!$B$1:$B$100)=-TRIM(B$1)))
and i need to copy the formula across 50R*50C.
Thanks!
--
Regards,
Linda

Why dont you place your formula in a area away from where you want to
chart.
Then copy the result from your formula and paste special to the cell
where you want to chart from?
Maybe create your formula in another sheet in your workbook?
Does thathelp?
Mark




--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default cell with formula

Sorry, not that I know.

linda wrote:

thanks for reply Dave,
but i already tried both of your suggestion and both dont work.na() still
include in charts.and if i copy & replace,its still charting the empty cell
that include in the entire range.
thats why i have to copy the value from cell to cell,but then its running
too slow.
is there any other ways?
--
Regards,
Linda

"Dave Peterson" wrote:

If you really want a macro, how about:

copy the entire range
paste as values
select that pasted range
edit|replace
what: 0 (match entire cell contents!)
with: (leave blank)
replace all

linda wrote:

i've done that already but the chart still include the data which the formula
returns zero.what i'm doing right now is copy the value of cell via macro to
another area for me to create the chart but its running too slow.sometimes,it
takes hours.
this is my macro:
Do While Cells(a, b).Value < ""
x = a
Do While Cells(x, b).Value < ""
Cells(x, y).Value = Cells(x, b).Value
x = x + 1
Loop
b = b + 1
y = y + 1
Loop
--
Regards,
Linda

" wrote:

On 19 Sep, 09:32, linda wrote:
Hi!
how to set a formula to cell using macro?i dont want to type the formula in
the particular cell since i face problem to create chart from the data.
here's the formula:
=SUMPRODUCT((TRIM(Sheet1!$A$1:$A$100)=TRIM($A2))*( TRIM(Sheet1!$B$1:$B$100)=-TRIM(B$1)))
and i need to copy the formula across 50R*50C.
Thanks!
--
Regards,
Linda

Why dont you place your formula in a area away from where you want to
chart.
Then copy the result from your formula and paste special to the cell
where you want to chart from?
Maybe create your formula in another sheet in your workbook?
Does thathelp?
Mark




--

Dave Peterson


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default cell with formula

I'm not quite sure what you want but I just put the formula in a3 and
recorded this. Maybe you can modify to suit.
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 9/19/2007 by Donald B. Guillett
'

'
Selection.AutoFill Destination:=Range("A3:J3"), Type:=xlFillDefault
Range("A3:J3").Select
Selection.AutoFill Destination:=Range("A3:J22"), Type:=xlFillDefault
Range("A3:J22").Select
End Sub

modified
Sub makeformulas()
Range("b2").Formula = "=SUMPRODUCT((TRIM(Sheet1!$A$1:$A$100)" _
& "=TRIM($A2))*(TRIM(Sheet1!$B$1:$B$100)=TRIM(B$1))) "
Range("b2").AutoFill Destination:=Range("b2:J2")
Range("b2:J2").AutoFill Destination:=Range("b2:J22")
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"linda" wrote in message
...
Hi!
how to set a formula to cell using macro?i dont want to type the formula
in
the particular cell since i face problem to create chart from the data.
here's the formula:
=SUMPRODUCT((TRIM(Sheet1!$A$1:$A$100)=TRIM($A2))*( TRIM(Sheet1!$B$1:$B$100)=TRIM(B$1)))
and i need to copy the formula across 50R*50C.
Thanks!
--
Regards,
Linda


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
How can I make a blank cell in a formula cell with a range of cell Vi Excel Discussion (Misc queries) 5 June 21st 07 02:46 PM
adding a formula in a cell but when cell = 0 cell is blank Mike T Excel Worksheet Functions 5 May 31st 05 01:08 AM
Cell Formula reference to cell Based On third Cell Content Gabriel Excel Discussion (Misc queries) 1 February 11th 05 06:36 AM
Cell Formula reference to cell Based On third Cell Content Gabriel Excel Discussion (Misc queries) 0 February 11th 05 05:35 AM
Cell doesn't show formula result - it shows formula (CTRL + ' doe. o0o0o0o Excel Worksheet Functions 6 November 19th 04 03:13 PM


All times are GMT +1. The time now is 06:02 PM.

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

About Us

"It's about Microsoft Excel"