Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Suming a column to another worksheet
Hello everyone, I am new to Excel programming, however, I am a software developer. thought a forum would be best place to get my question answered. Here' what I want to do: On the first worksheet I have a column (multiple rows) that can hav one of 23 names entered in it. In the column next to that (als multiple rows), a dollar amount is entered. On the next worksheet I have all the names on different rows, wit their total amount. I'm assuming I would need to code some sort o macro or something to take the amounts for each person on the firs worksheet and add it to their individual totals on the secon worksheet, correct? If someone could point me to either a tutorial that would demonstrat how to do this, or maybe a snippet of code, that would be great. Thanks! Chri -- CRY ----------------------------------------------------------------------- CRYM's Profile: http://www.excelforum.com/member.php...fo&userid=3528 View this thread: http://www.excelforum.com/showthread.php?threadid=55071 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Suming a column to another worksheet
it sounds like the sumproduct function can do what you want check this out and see if it will do what you need - it does wor across (even closed) worksheets. http://www.xldynamic.com/source/xld.SUMPRODUCT.htm -- duan ----------------------------------------------------------------------- duane's Profile: http://www.excelforum.com/member.php...fo&userid=1162 View this thread: http://www.excelforum.com/showthread.php?threadid=55071 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Suming a column to another worksheet
Hi there and welcome to the wild, wooly world of Excel programming. Here's
some code that should accomplish what you want. I've made a couple of assumptions for the code below to work so you'll need to do this also. (1) Create a range name called "CurrAmountsList" for the two columns (names and amounts) in your "current" dollar amounts list (note that the range can have more rows than the data currently within the range; it's just handy to have an identifiable range name that holds the maximum amount of names and amounts that you expect to be there) (2) Creat a range name called "AccAmountsList" for the two columns in your accumulated dollar amounts list (this is presumably the names of all the folks for whom you are accumulating bucks). P.S. If you don't know how to set up a range name, drop a reply post here and I'll tell you how. Sub AddBucks() 'Adds dollar amounts for individuals on Sheet 1 to the accumulated 'totals for those individuals on Sheet2 Dim i As Integer Dim CurrName As String, CurrBucks As Single Dim FindName As Integer Dim NameCount As Integer On Error Resume Next NameCount = Application.WorksheetFunction.CountA(Range("CurrAm ountsList")) For i = 1 To NameCount 'Select the first individual in the current amount list and set their name 'and current dollar value CurrName = Range("CurrAmountsList").Cells(i, 1).Value CurrBucks = Range("CurrAmountsList").Cells(i, 2).Value 'Determine where this individual is in the accumulated totals list FindName = Application.WorksheetFunction.Match(CurrName, Range("AccAmountsList").Columns(1), 0) Range("AccAmountsList").Cells(FindName, 2).Value = CurrBucks + Range("AccAmountsList").Cells(FindName, 2).Value Next i End Sub "CRYM" wrote: Hello everyone, I am new to Excel programming, however, I am a software developer. I thought a forum would be best place to get my question answered. Here's what I want to do: On the first worksheet I have a column (multiple rows) that can have one of 23 names entered in it. In the column next to that (also multiple rows), a dollar amount is entered. On the next worksheet I have all the names on different rows, with their total amount. I'm assuming I would need to code some sort of macro or something to take the amounts for each person on the first worksheet and add it to their individual totals on the second worksheet, correct? If someone could point me to either a tutorial that would demonstrate how to do this, or maybe a snippet of code, that would be great. Thanks! Chris -- CRYM ------------------------------------------------------------------------ CRYM's Profile: http://www.excelforum.com/member.php...o&userid=35287 View this thread: http://www.excelforum.com/showthread...hreadid=550711 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
suming under two condintions | Excel Discussion (Misc queries) | |||
suming every 3rd column | Excel Worksheet Functions | |||
suming in add-ins | Excel Worksheet Functions | |||
Suming up a Lookup | Excel Worksheet Functions | |||
Suming 2 cells if 1 = #N/A | Excel Worksheet Functions |