Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
add numbers in col A if values in col B = M only
Excel 2003 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"u999rbm" wrote in message
... add numbers in col A if values in col B = M only Excel 2003 Hi U, If a worksheet formula would suit, try: =SUMIF(B1:B100,"=M",A1:A100) --- Regards, Norman |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can use both worksheet functions or VBA to solve the problem.
First of all, let's see additional worksheet function solutions using array functions techniques. For example, if you got a list of numbers in A1:A20, and you got those "M" in the adjacent column (B). You can type the array formula: =SUM(A1:A20*((B1:B20)="M")) To input an array formula, after typing the formula, hold Ctrl+Shift then press Enter. Or, you can use the following "more clever" array formula: =SUM(A1:A20*(OFFSET(A1:A20,,1)="M")) Then, let's see the VBA solution. With the cells in column A selected, run the macro below. Sub example_macro() Dim a As Range Dim cell As Object Dim answer Set a = Selection 'can replace this with another range object description For Each cell In a If cell.Offset(0, 1).Value = "M" Then answer = answer + cell.Value End If Next MsgBox answer End Sub Regards, Edwin Tam http://www.vonixx.com "u999rbm" wrote: add numbers in col A if values in col B = M only Excel 2003 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What is =SUMIF(B1:B10,"M",A1:A10) ?
Good luck. Ken Norfolk, Va |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Vlookup for multiple values and return to one desired value | Excel Worksheet Functions | |||
IRR desired return | Excel Worksheet Functions | |||
Returning the desired value if multiple values exist???? | Excel Worksheet Functions | |||
Count number of times two columns have desired values | Excel Discussion (Misc queries) | |||
Simplicity is Desired | Excel Worksheet Functions |