LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Home Made Conditional Functions

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple functions, conditional functions HeatherBelle Excel Worksheet Functions 7 October 17th 08 03:57 PM
Problems with functions made in different languagues Berbel Excel Discussion (Misc queries) 3 May 2nd 07 03:04 PM
Shortcut keys: CNTRL+HOME vs. HOME Paul Ofthewild Excel Discussion (Misc queries) 1 November 24th 05 09:29 PM
conditional functions j Excel Worksheet Functions 2 December 10th 04 02:55 PM
conditional functions juliafw Excel Worksheet Functions 1 December 9th 04 05:19 PM


All times are GMT +1. The time now is 07:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"