Solved

Need Help With VBA Query

Posted on 2014-12-12
5
59 Views
Last Modified: 2015-01-13
I have a file where I'm trying to find all records that are associated with each other.  The criteria is as follows:
If there is a cost in column K, look at column B & C.  All preceding rows with the same value in colums B&C should be copied to Sheet 2.

Sample file attached.  Can some one help me please?
Exchange-VBA-FIle.xlsx
0
Comment
Question by:ArisaAnsar
5 Comments
 

Author Comment

by:ArisaAnsar
ID: 40497619
Please can some one help?
0
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 250 total points
ID: 40497682
Hi,

You could use this formula to filter out the lines with zero result(array formula so enter with Ctrl-Shift-Enter)

=MAX(($B$2:$B$75=B2)*($C$2:$C$75=C2)*$K$2:$K$75)

Regards
Exchange-VBA-FIleV1.xlsx
0
 
LVL 31

Assisted Solution

by:Rob Henson
Rob Henson earned 250 total points
ID: 40500086
Assuming already sorted by columns B & C, a non-array formula in column L to show those with values, starting in L2 and copied down:

=IF(AND(B2=B1,C2=C1),L1,K2)

You can then use Auto Filter to filter in place. When you copy a filtered list only those records which are visible will be copied so can then be pasted into another list.

Alternatively, you can use Advanced Filter, this gives the option to copy to another location and can just copy certain columns if so required.

Thanks
Rob H
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40546219
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

759 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

21 Experts available now in Live!

Get 1:1 Help Now