Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

excel formula

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jaypee - 24 Mar 2006 04:22 GMT
good day!

i need a excel formula that counts FAC, 1,SL or VL as 1.

FAC    1    SL
FAC    1    SL
FAC    2    SL
FAC    1    VL
FIS      1    VL

in this sample the formula must count 3..

thanks
R..VENKATARAMAN - 24 Mar 2006 05:07 GMT
try this though inelegant macro

Public Sub test()
Dim i As Integer
i = 0
Dim myrange As Range
Dim c As Range
Set myrange = Range(Range("a1"), Range("a1").End(xlDown))
For Each c In myrange
If c = "FAC" And c.Offset(0, 1) = "1" _
And c.Offset(0, 2) = "SL" _
Then i = i + 1
Next
For Each c In myrange
If c.Offset(0, 2) = "SL" Then i = i + 1
Next
MsgBox i
End Sub

> good day!
>
[quoted text clipped - 9 lines]
>
> thanks
R..VENKATARAMAN - 24 Mar 2006 05:14 GMT
sorry threr is some mistake in the macro I have given . ignore the message

"R..VENKATARAMAN" <venkat1926@touchtelindia.net> wrote in message news:...
> try this though inelegant macro
>
[quoted text clipped - 28 lines]
>>
>> thanks
Mike Middleton - 24 Mar 2006 08:11 GMT
jaypee  -

Have you considered putting some field names at the top so that it's an
Excel database/list and then using a Pivot Table to do the counting?

(I don't understand your test data. The SL/VL seems to be irrelevant.)

-  Mike
www.mikemiddleton.com

> good day!
>
[quoted text clipped - 9 lines]
>
> thanks
Randy  Harmelink - 24 Mar 2006 08:50 GMT
Although the array-entered formula suggested by someone else works, I
try to avoid them whenever possible.  In many cases, they can be
replaced with a similar SUMPRODUCT() formula.  For example:

=SUMPRODUCT(
    --(A1:A5="FAC"),
    --(B1:B5=1),
    --(C1:C5="SL")--(C1:C5="VL"))
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.