+ Reply to Thread
Results 1 to 10 of 10

Compare two excel sheets w/different headers to return rows according to criteria

  1. #1
    Registered User
    Join Date
    05-20-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    17

    Compare two excel sheets w/different headers to return rows according to criteria

    Hi guys,

    I tried asking about this yesterday, but it was REALLY complicated and no one bit. So I created a simpler file with essentially the same info needing the same thing.

    Let's say my company rents out parking spaces to people at a monthly rate, to be paid on the anniversary day of your start date. (If you started renting 7/3/12, you'd pay on 8/3/12, 9/3/12, etc. for as long as you're renting the space). Within the first 36 months of rent (3 yrs), we will fill your gas tank for free (I know that's ludicrous, just an example). Since we're tracking the gas, we still make an order in our billing software every time we fill your tank, just at $0.00. Starting in the 37th month (any time past 3 yrs), tenants need to start paying whenever they want tanks.

    So, I attached two sheets (in one workbook) with:
    -Anyone renting a parking space and the date they started renting
    -Any order for gas fillups

    I need to find a way to identify parkers who've filled up after their 3 year limit, so that I can bill for them.

    Can someone help me?! Basically, I need to find common names in both lists, and separate them according to specific criteria.

    Any assistance or direction or suggestions are much appreciated...

    Thanks in advance!
    Attached Files Attached Files
    Last edited by justin11; 08-02-2013 at 04:37 PM. Reason: Forgot attachment!

  2. #2
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Compare two excel sheets w/different headers to return rows according to criteria

    This is rather quick and crude but it might get you going. The values over 3 in the results are what I think you are looking for.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  3. #3
    Registered User
    Join Date
    05-20-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Compare two excel sheets w/different headers to return rows according to criteria

    Thanks, newdoverman!

    That performed the first steps exactly as needed. Now I can see which people have filled up more than 3 years after their start date. I can bill for these people, but there are a couple who've already been billed (Adlai Stevenson-"Item ID 'BILL' means we've already found out they were over their 3 year span and billed them. So the next thing I need to do is identify those who we already recognized as having more than three years between their start date and their last fillup date, so I can exclude them from a list of people for whom I haven't made the "BILL" order yet.

    Thanks in advance for any feedback or solutions you have for this part.
    Attached Files Attached Files

  4. #4
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Compare two excel sheets w/different headers to return rows according to criteria

    Is this what you mean?
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-20-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Compare two excel sheets w/different headers to return rows according to criteria

    Hey newdoverman, that worked great! -- but not for what I actually need now-I had to change something.

    I had to separate the "charge for fill" from the "fillup" for a couple reasons: I noticed the equation pulls only the first instance of a "fillup" order. So I had to organize the data on the ORDERS sheet from newest to oldest so that when the equation on RENTALS pulls the first instance, it's the most recent fillup order from ORDERS. The problem is, when I organize this way, the most recent instance may actually be the "charge for fillup," which I don't want to count.

    Can you check out this workbook and figure out how to cross-reference the GAS ALREADY BILLING to exclude or at least to identify (as your most recent equation did) which people are already being billed for the fillup?

    This is my actual data set, with confidential and sensitive material removed. For the example we've been using, "fillup"="gas contents x tanks," "bill"="GAS" and "PRKLT"="E0431". I hope this makes sense!

    Thanks again in advance!
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-20-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Compare two excel sheets w/different headers to return rows according to criteria

    If you don't have time to do this, I understand, but if that's the case, could you just help me understand what each argument means and why you use them?

    =IF(COUNTIFS(ORDERS!$G$2:$G$15,RENTAL!H2,ORDERS!$D$2:$D$15,"Bill")=0,"",COUNTIFS(ORDERS!$G$2:$G$15,RENTAL!H2,ORDERS!$D$2:$D$15,"Bill"))

    Thanks!

  7. #7
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Compare two excel sheets w/different headers to return rows according to criteria

    I will try to get to your actual worksheet and see how it actually ties into what the original problem was.

    Today isn't a good day but I will see what I can do.

    This formula "=IF(COUNTIFS(ORDERS!$G$2:$G$15,RENTAL!H2,ORDERS!$D$2:$D$15,"Bill")=0,"",COUNTIFS(ORDERS!$G$2:$G$15,RENTAL!H2,ORDERS!$D$2:$D$15,"Bill"))" means: If the first part in brackets starting with COUNTIFS is equal to 0 enter "" (a blank cell) and if it isn't equal to 0 perform the COUNTIFS formula and give the result.

    The COUNTIFS formula says to go to tab ORDERS and in the range G2:G15 count the records that match H2 on the RENTAL tab THEN on the ORDERS tab in the range D2:D15, count the entries that match "Bill". The two ranges with the two criteria counts the records that match both criteria. In this case it would count the matches for Hendrix Jimi and Bill and count the occurrences of that combination. If Hendrix Jimi had 14 Bills then the COUNTIFS would return the number 14. The COUNTIFS doesn't "return" records it only counts records according to the criteria set.

  8. #8
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Compare two excel sheets w/different headers to return rows according to criteria

    This might help you out somewhat.

    This will count the occurrences in Already billing. Enter on the Rentals tab and copy down.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This compares ALREADY BILLING with the ORDERS tab. Enter on the ALREADY BILLING TAB to get the number of orders for each ID.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This will give the total number of orders for each ID on the RENTALS tab.

    Formula: copy to clipboard
    Please Login or Register  to view this content.



    The file has become too large to upload.

  9. #9
    Registered User
    Join Date
    05-20-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Compare two excel sheets w/different headers to return rows according to criteria

    Sorry I couldn't respond to this earlier. Everything works PERFECTLY!

    Thanks so much for your help and for explaining the functions to me. I'll be able to use this in the future. My job requires me to compare reports like this frequently, and this will save me so much time!

    I'd give you rep, but it says I can't until I give someone else some.

  10. #10
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Compare two excel sheets w/different headers to return rows according to criteria

    Thanks for the feedback.

    Glad to have been of some help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Compare two columns from diff excel sheets and delete all non matching rows
    By Girija in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-24-2013, 11:08 PM
  2. Replies: 2
    Last Post: 11-13-2012, 02:56 PM
  3. Replies: 2
    Last Post: 05-09-2012, 01:30 PM
  4. Excel 2007 : Hide Rows below Sub Headers with criteria
    By guatelize in forum Excel General
    Replies: 1
    Last Post: 03-23-2012, 08:57 AM
  5. Replies: 5
    Last Post: 09-22-2009, 06:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1