Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
Obi Wan Kenobi: You're My Only...HELP!!!!!!
HELLO everyone! I seriously need some excel help? I've been reading
VB for Dummies and I still can't figure out how to do this with VB or use a function. I have this data set. A B C FUND OBJECT VALUE 01 8043 974906.61 01 8044 464605.5 01 8045 633509.09 01 8045 25612.02 03 8047 -1489111 04 8048 292190 05 8049 71675.66 06 8050 191774 I need to do the following: If for all values in A are = 1 and for all values in collumn B = 8045 then sum this with all other values in collumn C that meet these conditions. Spit the total sum and place on Sheet2 cell A2. Does anyone know how to write this either in VB or how to use the functions to make excel do this? It would have to be pretty easy to customize if more collumns or conditions were added? I would be sooooooo appreciated if someone could figure it out; For this example it should spit out: 659121.11 on the sheet2. ! T H A N K Y O U ! |
#2
Posted to microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
Obi Wan Kenobi: You're My Only...HELP!!!!!!
Try this:
=SUMPRODUCT(--(Sheet1!A2:A9="01"),--(Sheet1!B2:B9=8045),Sheet1!C2:C9) if 1 is a real value not a text value then try the formula belowed =SUMPRODUCT(--(Sheet1!A2:A9=1),--(Sheet1!B2:B9=8045),Sheet1!C2:C9) " wrote: HELLO everyone! I seriously need some excel help? I've been reading VB for Dummies and I still can't figure out how to do this with VB or use a function. I have this data set. A B C FUND OBJECT VALUE 01 8043 974906.61 01 8044 464605.5 01 8045 633509.09 01 8045 25612.02 03 8047 -1489111 04 8048 292190 05 8049 71675.66 06 8050 191774 I need to do the following: If for all values in A are = 1 and for all values in collumn B = 8045 then sum this with all other values in collumn C that meet these conditions. Spit the total sum and place on Sheet2 cell A2. Does anyone know how to write this either in VB or how to use the functions to make excel do this? It would have to be pretty easy to customize if more collumns or conditions were added? I would be sooooooo appreciated if someone could figure it out; For this example it should spit out: 659121.11 on the sheet2. ! T H A N K Y O U ! |
#3
Posted to microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
Obi Wan Kenobi: You're My Only...HELP!!!!!!
=SUMPRODUCT(--(A2:A8=1),--(B2:B8=8045),C2:C8)
-- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) wrote in message oups.com... HELLO everyone! I seriously need some excel help? I've been reading VB for Dummies and I still can't figure out how to do this with VB or use a function. I have this data set. A B C FUND OBJECT VALUE 01 8043 974906.61 01 8044 464605.5 01 8045 633509.09 01 8045 25612.02 03 8047 -1489111 04 8048 292190 05 8049 71675.66 06 8050 191774 I need to do the following: If for all values in A are = 1 and for all values in collumn B = 8045 then sum this with all other values in collumn C that meet these conditions. Spit the total sum and place on Sheet2 cell A2. Does anyone know how to write this either in VB or how to use the functions to make excel do this? It would have to be pretty easy to customize if more collumns or conditions were added? I would be sooooooo appreciated if someone could figure it out; For this example it should spit out: 659121.11 on the sheet2. ! T H A N K Y O U ! |
#4
Posted to microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
Obi Wan Kenobi: You're My Only...HELP!!!!!!
On Jul 13, 6:26 pm, "Bob Phillips" wrote:
=SUMPRODUCT(--(A2:A8=1),--(B2:B8=8045),C2:C8) -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) wrote in message oups.com... HELLO everyone! I seriously need some excel help? I've been reading VB for Dummies and I still can't figure out how to do this with VB or use a function. I have this data set. A B C FUND OBJECT VALUE 01 8043 974906.61 01 8044 464605.5 01 8045 633509.09 01 8045 25612.02 03 8047 -1489111 04 8048 292190 05 8049 71675.66 06 8050 191774 I need to do the following: If for all values in A are = 1 and for all values in collumn B = 8045 then sum this with all other values in collumn C that meet these conditions. Spit the total sum and place on Sheet2 cell A2. Does anyone know how to write this either in VB or how to use the functions to make excel do this? It would have to be pretty easy to customize if more collumns or conditions were added? I would be sooooooo appreciated if someone could figure it out; For this example it should spit out: 659121.11 on the sheet2. ! T H A N K Y O U !- Hide quoted text - - Show quoted text - I would assume that a more general result is desired. Not just a sum of that 1 simple value. What you want to do is look at pivot tables. They can be used to sort through groups of data and total values. Peter |
#5
Posted to microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
Obi Wan Kenobi: You're My Only...HELP!!!!!!
=SUMPRODUCT((Sheet1!A2:A9=Sheet1!A2)*(Sheet1!B2:B9 =Sheet1!B4),Sheet1!
C2:C9) Matching cell values in a lookup rather than specifying a static value eliminates some comparison errors. This formula will give you the desired result. Nick |
#6
Posted to microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
Obi Wan Kenobi: You're My Only...HELP!!!!!!
" wrote:
HELLO everyone! I seriously need some excel help? I've been reading VB for Dummies and I still can't figure out how to do this with VB or use a function. I have this data set. A B C FUND OBJECT VALUE 01 8043 974906.61 01 8044 464605.5 01 8045 633509.09 01 8045 25612.02 03 8047 -1489111 04 8048 292190 05 8049 71675.66 06 8050 191774 I need to do the following: If for all values in A are = 1 and for all values in collumn B = 8045 then sum this with all other values in collumn C that meet these conditions. Spit the total sum and place on Sheet2 cell A2. Does anyone know how to write this either in VB or how to use the functions to make excel do this? It would have to be pretty easy to customize if more collumns or conditions were added? I would be sooooooo appreciated if someone could figure it out; For this example it should spit out: 659121.11 on the sheet2. ! T H A N K Y O U ! Your example is a little unclear, but if I get you right, what you're trying to do is essentially a SUMIF with _two_ conditions. I do this a thousand times a day, with the SUM(IF()) construct. In your example, it'd look like this: =SUM(IF((A2:A9=1)*(B2:B9=8045),C2:C9,0)) What this says is "sum some cells; where the two conditions are both true, use the corresponding value from C, otherwise use zero." Note the parenthesis around the two conditions, and the asterisk in between. The asterisk says "both conditions," there are other options for "or" and "xor." You probably want similar sums for 01 and 8043, for 06 and 8050, and so forth. Just replace the "1" and "8045" in the formula with references to the A and B column. Of course, if you take this formula and copy it like this you'll probably want static references on the blocks, I skipped them just for visual clarity. IMPORTANT: This is an array formula, so you need to hit Ctrl+Shift+Enter instead of Enter after typing it in or editing it. I hope this helps! This formula is a lifesaver for me, I couldn't work without it. OK, there is another way: create an extra column that concatenates the first two: "=A2&"_"&B2", then "=SUMIF("01_8045", D2:D9)". But that takes up more space, and you have to hide the concatentated column. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|