Creating an Array Formula

F

fdtoo

I would like to create a Macro that would at least help me on th
following:

1) to copy the content of an excel filename"SaleForecast.xls" under
Worksheet name="Sales"
to another excel filename="ForecastSummary.xls" under worksheet
name="SalesSummary"

2) to look for a row of data that fits the following conten
criteria,e.g.
look for
cell value where Sales is >1000, Saleperson = John & Sales % i

ColumnA ColumnB ColumnC
Sales Saleperson Sales %
5000 Carmen 75
1000 John 30
8000 Weller 75
2000* John* 80*

*Note:Above data is under worksheet name "Salesman" and the whole rang
of
cell
where data are marked in * are required to be copied to a row belo
cell
where
value="Backlog" under worksheet name "SalesSummary" under the sam
excel
file

3) Using example above, to create a formula that will sum up all valu
under
Sales Column
where Sales % is >=75%, Saleperson = Carmen & Sales is >4000

fdtoo,
Thanks!
 
P

Patrick Molloy

assuming your table is A2:C5

Option Explicit

Sub SetFormula()
Dim frmla As String

frmla = "=SUM( (R2C2:R4C2=SalesPerson)" & _
"*(R2C1:R4C1>=Sales)" & _
"*(R2C3:R4C3>=Percent)" & _
"*(R2C1:R4C1))"

Range("G2").FormulaArray = frmla

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top