Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Im trying to figure out how to do a pretty basic operation with VBA. Let say we have a spread sheet with the range A1:A4 that contain a 1 or a 2, and a range B1:B4 containg any number. What I need to do is this: If the number in a cell in row A =1 add the number in the B row of the same column with any others that meet the critieria. I will show the nested function that accomplishes this task for clarification: "{=sum(if(A1:A3=1,B1:B3))}" the reason I can't use the nested function is that this is but a small portion of a very big operation im trying create. Here is what I have in VBA, the thing I don't understand is how to make it add up the numbers under number that meet the criteria: Function Maybe(A As Range, B As Range) Dim K As Integer For Each A In A If A = 1 Then K = K + B????????? End If Next Maybe = K End Function --- Message posted from http://www.ExcelForum.com/ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Multiple functions, conditional functions | Excel Worksheet Functions | |||
Problems with functions made in different languagues | Excel Discussion (Misc queries) | |||
Shortcut keys: CNTRL+HOME vs. HOME | Excel Discussion (Misc queries) | |||
conditional functions | Excel Worksheet Functions | |||
conditional functions | Excel Worksheet Functions |