Solved

Match 2 parameters then sum

Posted on 2011-03-04
6
305 Views
Last Modified: 2012-05-11
Dear experts,

I have 4 columns, Column A is "Customer Name", column B is "Invoice Date", Column C is "Invoice Amount" and column D is "Status"

  In cell G1 I have a user selected Customer Name.  In cell H1 i have user selected month/year.(Jan-11,Feb-11,etc.).

I would like the output of this formula to be placed in I1 and the logic is as follows:

If Company name Matches user selection, and invoice date is on the same month as the user selection, and invoice status is NOT rejected, return the sum of invoiced dollars for that business for that month.

  Can the above be done with VBA?


TIA
0
Comment
Question by:theos27
  • 3
  • 2
6 Comments
 
LVL 45

Accepted Solution

by:
patrickab earned 125 total points
ID: 35039370
>Can the above be done with VBA?

Yes, but use SUMPRODUCT() instead.

Patrick
0
 
LVL 45

Expert Comment

by:patrickab
ID: 35039371
Please upload you file.
0
 
LVL 45

Expert Comment

by:patrickab
ID: 35039374
Please upload your file.
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

by:theos27
ID: 35039479
Correction, I mean can the above be done without VBA.  Thanks.
0
 
LVL 50

Assisted Solution

by:barry houdini
barry houdini earned 125 total points
ID: 35039531
Like Patrick says you could use SUMPRODUCT, something like

=SUMPRODUCT((Customer_Name=G1)*(TEXT(Invoice_Date,"mmm-yy")=TEXT(H1,"mmm-yy"))*(Status<>"Rejected"),Invoice_Amount)

where Customer_Name, Invoice_Date, Status and Invoice_Amount are all same sized named ranges....or replace with actual cell references.

You could also use SUMIFS function if you have Excel 2007 or later....

regards, barry
0
 

Author Closing Comment

by:theos27
ID: 35039969
None
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now