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 / New Users / May 2008

Tip: Looking for answers? Try searching our database.

Excel 2003 - VBA - SUMIF

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Craig Brandt - 12 May 2008 15:30 GMT
Here is a tough one:

I have a table with rows of information including an ID Code. The ID code is
made up of four characters, each meaning something distinct. I want to
create a flexible reporting system where the user can specify which of these
rows to include in the report. Up to here there have been no problems,
example;

Code IMDA specifies an account that is active, indicated by the "A".  Most
accounts are Active but there is also the possibility for it to be Inactive,
in which case the Code would have been IMDI, for Inactive. To gather the Net
Worth of these accounts, I simply look for the distinct code.

SUMIF(A5:A1500,"IMDA",CW5:CW1500)

SUMIF(A5:A1500,"IMDI",CW5:CW1500)

Challenge:
I would like to have the ability to use wildcards (+) in the Code to
indicate that any character in that position should be considered a match.
The above code would produce a report that has two cells showing all Active
IMD accounts (IMDA), and all Inactive (IMDI).

I would like to offer the user the ability to insert the wildcard by
changing the code to be able to handle a Pseudo Code of IMD+ where the last
character is inconsequential to a match. In the real world, this "+" could
be in any position.

Does anyone have any suggestions on how to proceed?

Craig
edvwvw - 12 May 2008 16:03 GMT
This should give you a start point:

    CODE    VALUE     RESULT                                          INPUT
    IMDA    10     320               COUNT                          IM
    AAAA    20                   DON’T COUNT   
    BBBB    30                    DON’T COUNT   
    IMDA    40                   COUNT   
    IMAA    50                   COUNT   
    IMDA    60                   COUNT   
    IMD1    70                   COUNT   
    AAGH    80                   DON’T COUNT   
    IMDA    90                  COUNT   
    INDA    100                  DON’T COUNT   

CELL D2    SUMIF(C2:C11,"COUNT",A2:A11)               
CELL E2    IF(LEFT(B2,LEN($F$2))=$F$2,"COUNT","DON’T COUNT")

I cannot format this so it is eay to read - I will explain

CODE column C  VALUE column D  (helper column E)  INPUT coulmn F

edvwvw               

>Here is a tough one:
>
[quoted text clipped - 27 lines]
>
>Craig
edvwvw - 12 May 2008 16:04 GMT
>This should give you a start point:
>
[quoted text clipped - 24 lines]
>>
>>Craig
Ron Rosenfeld - 12 May 2008 17:48 GMT
>Here is a tough one:

>I would like to offer the user the ability to insert the wildcard by
>changing the code to be able to handle a Pseudo Code of IMD+ where the last
[quoted text clipped - 4 lines]
>
>Craig

The SUMIF text criteria uses the same wildcard tokens -- * or ? -- as does
other Excel functions that can use wild cards.

IMD? for a 4 character code starting with IMD and for which the 4th character
is irrelevant.

IMD* for any length code that starts with IMD
--ron
Craig Brandt - 12 May 2008 19:41 GMT
Ron:

It never ceases to amaze me. Some things that look impossible, turn out to
be really simple solutions.

Thanks again,
craig

> >Here is a tough one:
>
[quoted text clipped - 15 lines]
> IMD* for any length code that starts with IMD
> --ron
 
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.