Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What's the easiest way to search through Column A for a number (multiple
instances), and summing up all the numbers in Column B on the same row as the numebrs found in Column A? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
=SUMIF(A:A,33,B:B)
if you are searching for the number 33, for example. __________________________________________________ _____________________ "J@Y" wrote in message ... What's the easiest way to search through Column A for a number (multiple instances), and summing up all the numbers in Column B on the same row as the numebrs found in Column A? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Not entirely sure what you are asking for but i have decided to go with for each of the used cells in column A if the cell contains a number then take the number in column B for that row add it to a running total that will show at the end??? The code below will do just that though if it's not what you are looking for it should at least give you somewhere to start. Option Explicit Dim MyCell, MyRng As Range Dim SumTotal As Integer Dim LstRow As Integer Private Sub CommandButton1_Click() SumTotal = 0 LstRow = [A65535].End(xlUp).Row Set MyRng = Range("A1:A" & LstRow) For Each MyCell In MyRng If IsNumeric(MyCell.Value) = True Then SumTotal = SumTotal + MyCell.Offset(0, 1).Value End If Next MyCell MsgBox SumTotal End Sub hope this is of some help S |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would use
=sumif(a:a,789,b:b) in a cell in a worksheet In code, I'd use: with worksheets("sheet1") msgbox application.sumif(.range("a:a"),789,.range("b:b")) end with J@Y wrote: What's the easiest way to search through Column A for a number (multiple instances), and summing up all the numbers in Column B on the same row as the numebrs found in Column A? -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Vasant's approach can also be implemented in VBA if you must do this as part of a macro. With Worksheets("Sheet1") Tot = Application.Countif(.Columns(1),.Range("A1"),.Colu mns(2)) End with where cell A1 contains the number you are looking for, but that could be in any cell. For example Z22 With Worksheets("Sheet1") Tot = Application.Countif(.Columns(1),.Range("Z22"),.Col umns(2)) End with or just in a variable num = 32 With Worksheets("Sheet1") Tot = Application.Countif(.Columns(1),num,.Columns(2)) End with -- Regards, Tom Ogilvy "Incidental" wrote: Hi Not entirely sure what you are asking for but i have decided to go with for each of the used cells in column A if the cell contains a number then take the number in column B for that row add it to a running total that will show at the end??? The code below will do just that though if it's not what you are looking for it should at least give you somewhere to start. Option Explicit Dim MyCell, MyRng As Range Dim SumTotal As Integer Dim LstRow As Integer Private Sub CommandButton1_Click() SumTotal = 0 LstRow = [A65535].End(xlUp).Row Set MyRng = Range("A1:A" & LstRow) For Each MyCell In MyRng If IsNumeric(MyCell.Value) = True Then SumTotal = SumTotal + MyCell.Offset(0, 1).Value End If Next MyCell MsgBox SumTotal End Sub hope this is of some help S |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi
I'd just like to confuse things further, I have an accounts table showing income. I would like to total the results of two columns eg. if my income is due to "membership" then I would like to total the "membership" income, which is shown in columns D, E and F (voucher, cheque, and cash) I tried the formula below but it only seems to total d3:d21 even tho i've stated d3:f21 =SUMIF(B3:B21,"membership",D3:F21) The only way I can get it to work is by using the following formula =SUM(SUMIF(B3:B21,"membership",D3:D21),SUMIF(B3:B2 1,"membership",E3:E21),SUMIF(B3:B21,"membership",F 3:F21)) which as you can see is very long, is there a shorter, quicker formula? "Vasant Nanavati" wrote: =SUMIF(A:A,33,B:B) if you are searching for the number 33, for example. __________________________________________________ _____________________ "J@Y" wrote in message ... What's the easiest way to search through Column A for a number (multiple instances), and summing up all the numbers in Column B on the same row as the numebrs found in Column A? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help! I can't get any search results | Excel Discussion (Misc queries) | |||
Search Results | Excel Discussion (Misc queries) | |||
multiple results from search / how to? | Excel Discussion (Misc queries) | |||
I cant do a search on this forum. Everytime I search, it comes up with zero results | Excel Programming | |||
multiple results search | Excel Programming |