+ Reply to Thread
Results 1 to 3 of 3

Stuck. averaging lookup results if matching criteria

  1. #1
    Registered User
    Join Date
    03-08-2018
    Location
    Essex, England
    MS-Off Ver
    2016
    Posts
    1

    Stuck. averaging lookup results if matching criteria

    Hello,

    Although I have some experience with Excel, I'm still a beginner. I've been really trying with this one, but I'm stuck.
    I've recorded some data on how often I've filled the car up with petrol in 2017, when, by whom, where, how much it cost, etc.
    If you look at screenshot 1, the cell highlighted (C42) is what I'm currently having trouble filling. Before that, I had trouble filling in the one above (C41). My dad created a macro to deal with this, but I wondered if there was a way to do it without using macros. Proceeding with the current problem (that of C42), I decided to see if creating some extra rows below (which I intend to hide in the end) may help work everything out (see screenshot 2). I actually manged to fill C41 using these rows instead of the macro, however I'm still struggling to fill C42.
    To fill C42, I need to look in row 28 for the month stored in B46:B57, sum the costs that correspond to that month, then store it in D46:D57. Then, to get the average I need to sum the costs that are greater than 0, and divide that by the number of costs that are greater than 0.

    Am I correct? If so, how do I do that? It's got to be possible without VBA, but I'm just unsure how. I thought it might have something to do with V/HLookup, or IndexMatch, or IndexMatchMatch (all of which I'm still a little unfamiliar with), but I'm not sure. Please help!

    Thank you very much,
    Chris
    Attached Images Attached Images

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Stuck. averaging lookup results if matching criteria

    Hi, welcome to the forum

    To best describe or illustrate your problem you would be better off attaching a dummy workbook. The workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Stuck. averaging lookup results if matching criteria

    I would deal with this with a different layout to start.

    Headers;
    DATE - FILLED BY - SERVICE STATION - COST

    Fill the table with all your data then create a pivot table that looks like it would answer all your questions.

+ 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. Combobox value loop column lookup and return all matching results to a sheet
    By ToSonder in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-27-2016, 01:39 AM
  2. [SOLVED] VLOOKUP between workbooks, don't return results matching a 2nd column criteria?
    By Tunesmith in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-09-2014, 11:58 AM
  3. Lookup multiple & non duplicated results for multiple matching criteria
    By melvil007 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-19-2012, 01:22 AM
  4. Lookup criteria matching in rows and columns
    By JuJuBe in forum Excel General
    Replies: 2
    Last Post: 05-20-2010, 05:03 PM
  5. sum index results matching multiple criteria
    By oats in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 07-15-2009, 11:46 AM
  6. Lookup matching criteria based on cell value
    By G_excel_280 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-19-2009, 02:21 PM
  7. Replies: 0
    Last Post: 08-23-2005, 11:53 AM

Tags for this Thread

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