Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Should I use sumproduct function?

Hello,
I have the following table on sheet1.
State Jan08 Feb08 Mar08
Ny 1000 1500 1800
NJ 8000 2500 3000
-
-

How do I bring in the above info to the below format on sheet2 without
having to do copy and paste. I would love to use some kind of
function that will compare state and the month and will give me the
numbers as the output.

State Jan08 Feb08 Mar08
Ny 1000 1500 1800
Growth
Gross
Net
# of Leads
NJ 8000 2500 3000
Growth
Gross
Net
# of Leads

thanks!



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Should I use sumproduct function?

Are these rows already there? If, do they have any data? You could use a
looping macro to copy and then paste 4 rows down from the last row on the
destination sheet.

Growth
Gross
Net
# of Leads

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

wrote in message
...
Hello,
I have the following table on sheet1.
State Jan08 Feb08 Mar08
Ny 1000 1500 1800
NJ 8000 2500 3000
-
-

How do I bring in the above info to the below format on sheet2 without
having to do copy and paste. I would love to use some kind of
function that will compare state and the month and will give me the
numbers as the output.

State Jan08 Feb08 Mar08
Ny 1000 1500 1800
Growth
Gross
Net
# of Leads
NJ 8000 2500 3000
Growth
Gross
Net
# of Leads

thanks!




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Should I use sumproduct function?

You really just need a simple macro.

Sub CreateSheet2()

RowCount = 2
NewRowCount = 2

'copy header row from sheet1 to sheet2
Sheets("Sheet1").Rows(1).Copy _
Destination:=Sheets("Sheet2").Rows(1)

With Sheets("Sheet1")
Do While .Range("A" & RowCount) < ""
.Rows(RowCount).Copy
With Sheets("Sheet2")
.Rows(NewRowCount).Paste
.Range("A" & (NewRowCount + 1)) = "Growth"
.Range("A" & (NewRowCount + 2)) = "Gross"
.Range("A" & (NewRowCount + 3)) = "Net"
.Range("A" & (NewRowCount + 4)) = "# Number of Leads"
NewRowCount = NewRowCount + 5
End With
RowCount = RowCount + 1
Loop
End With

End Sub


" wrote:

Hello,
I have the following table on sheet1.
State Jan08 Feb08 Mar08
Ny 1000 1500 1800
NJ 8000 2500 3000
-
-

How do I bring in the above info to the below format on sheet2 without
having to do copy and paste. I would love to use some kind of
function that will compare state and the month and will give me the
numbers as the output.

State Jan08 Feb08 Mar08
Ny 1000 1500 1800
Growth
Gross
Net
# of Leads
NJ 8000 2500 3000
Growth
Gross
Net
# of Leads

thanks!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Should I use sumproduct function?

On Nov 10, 3:23*pm, Joel wrote:
You really just need a simple macro.

Sub CreateSheet2()

RowCount = 2
NewRowCount = 2

'copy header row from sheet1 to sheet2
Sheets("Sheet1").Rows(1).Copy _
* *Destination:=Sheets("Sheet2").Rows(1)

With Sheets("Sheet1")
* *Do While .Range("A" & RowCount) < ""
* * * .Rows(RowCount).Copy
* * * With Sheets("Sheet2")
* * * * *.Rows(NewRowCount).Paste
* * * * *.Range("A" & (NewRowCount + 1)) = "Growth"
* * * * *.Range("A" & (NewRowCount + 2)) = "Gross"
* * * * *.Range("A" & (NewRowCount + 3)) = "Net"
* * * * *.Range("A" & (NewRowCount + 4)) = "# Number of Leads"
* * * * *NewRowCount = NewRowCount + 5
* * * End With
* * * RowCount = RowCount + 1
* *Loop
End With

End Sub



" wrote:
Hello,
I have the following table on sheet1.
State * * * *Jan08 *Feb08 Mar08
Ny * * * * * * *1000 * *1500 * 1800
NJ * * * * * * * 8000 * 2500 * *3000
-
-


How do I bring in the above info to the below format on sheet2 without
having to do copy and paste. *I would love to use some kind of
function that will compare state and the month and will give me the
numbers as the output.


State * * * * Jan08 *Feb08 Mar08
Ny * * * * * * *1000 * *1500 * 1800
Growth
Gross
Net
# of Leads
NJ * * * * * * * 8000 * 2500 * *3000
Growth
Gross
Net
# of Leads


thanks!- Hide quoted text -


- Show quoted text -


I got the answer without having to use the macro. I used sumproduct
function. Here is the formula that I've used
=SUMPRODUCT(($B$8:$K$8=B1)*($A$9:$A$22=A1)*($B$9:$ K$22))
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
Sumproduct with Condition OR Sumproduct with ADDRESS function - HE gholly Excel Discussion (Misc queries) 2 September 28th 09 05:07 PM
sumproduct function / VB user defined function aw Excel Discussion (Misc queries) 3 September 23rd 08 09:05 AM
SumProduct Function Mike H. Excel Programming 2 September 7th 07 05:52 PM
Is SUMPRODUCT the right function to use? Twishlist Excel Worksheet Functions 4 July 24th 07 02:32 AM
SUMIF Function Inside SUMPRODUCT Function Abdul Waheed Excel Worksheet Functions 17 September 19th 05 04:24 PM


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