+ Reply to Thread
Results 1 to 20 of 20

Vlookup and Average

  1. #1
    Registered User
    Join Date
    01-25-2008
    Posts
    19

    Vlookup and Average

    One last formula to go.... I think...

    Ok so we have the vlookup command..
    it is searching for a specific id number, the id number has three values next to it. I need the formula to find the id then display the average of the 3 values next to it.
    I tried this:
    =AVERAGE(VLOOKUP(K3,'CSR Data'!$G$3:$J$41,2,FALSE))

    the averages aren't matching.
    the id is 33126
    the totals to average are 88.6%, 79.1% and 85.0%

    to my calculations the average is 84.23
    but the formula displays 88.64

    just the average command on those cells displays 84.25


    What am I doing wrong?

    bpaw

  2. #2
    Registered User
    Join Date
    01-25-2008
    Posts
    19

    so far

    I figured out the end portion isn't working, because the 2 would be telling it to output the data from the second field.

    I am also trying this formula:
    VLOOKUP(AVERAGE('CSR Data'!H3:J4)(K4,'CSR Data'!G3:J41,2))
    this one just came back an error or added a * before k4


    bpaw

  3. #3
    Registered User
    Join Date
    01-25-2008
    Posts
    19

    and again

    ok, I tried this formula... I may be getting closer, but the output is still wrong.

    =VLOOKUP(K2,'CSR Data'!$G$3:$J$41,AVERAGE(2,3,4))

    this returns the first number of the three that needs to be averaged


    bpaw

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    VLOOKUP will only return one item.

    If you want to bring back more than one response, then you will need to do something else.

    Try
    =sumproduct(--('CSR Data'!$G$3:$G$41 = k2),($H$3:$H$41)) / countif('CSR Data'!$G$3:$G$41,K2)

    rylo

  5. #5
    Registered User
    Join Date
    01-25-2008
    Posts
    19

    vlookup average

    I don't want more than one response. I just need the average of the three numbers that follow the id.

    Vlookup is suppose to find the id, then i am working on the portion that will average the 3 numbers after then id and display it in the field.

    bpaw

  6. #6
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Try this,

    =AVERAGE(VLOOKUP(K3,'CSR Data'!$G$3:$J$41,2,FALSE)):VLOOKUP(K3,'CSR Data'!$G$3:$J$41,3,FALSE)):VLOOKUP(K3,'CSR Data'!$G$3:$J$41,4,FALSE)))

    But enter as Ctrl+Shift+Enter to put { } around the formula in the formula bar
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  7. #7
    Registered User
    Join Date
    01-25-2008
    Posts
    19

    ??

    i don't understand the part you said about ctl+shift+enter

    If I enter as it is typed, it give an error so I am assuming that I need the ctl+shift+enter..

    Can you please explain further?

    Thanks
    bpaw

  8. #8
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    ENTERING AN ARRAY FORMULA: To enter a formula as an array formula, type the formula in the cell and press the CTRL SHIFT and ENTER keys at the same time rather then just ENTER. You must do this the first time you enter the formula and whenever you edit the formula later. If you do this properly, Excel will display the formula enclosed in curly braces { }. You do not type in the braces -- Excel will display them automatically. If you neglect to enter the formula with CTRL SHIFT ENTER, the formula may return a #VALUE error or return an incorrect result.

    http://www.cpearson.com/excel/ArrayFormulas.aspx

    http://office.microsoft.com/en-us/ex...872901033.aspx

  9. #9
    Registered User
    Join Date
    01-25-2008
    Posts
    19

    hmm

    Ok, a couple of questions...
    I think I understand the concept now, however if I put the formula in the field then push control+shift+enter all at the same time, it then displays the formula, not the result.

    so first question is must I type the formula or can I copy and paste it?
    second question is when I type the formula must I be exact in pushing all three buttons at the same time?
    last, once (if i ever can) get this formula to work, can I copy and paste it to the remaining other 39 cells?

    I am reading the links you sent, but apparently I am having some kind of brain overload.

    sorry about this... I am usually not such a dork when it comes to instructions.

    bpaw

  10. #10
    Registered User
    Join Date
    01-25-2008
    Posts
    19

    grr

    So I need to sit on a curb and kick a rock.
    This is just blowing my mind.

    I know I am missing something but I can't figure it out.
    Attached Files Attached Files

  11. #11
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi,

    Ok, we're nearly there!

    however if I put the formula in the field then push control+shift+enter all at the same time, it then displays the formula, not the result.

    It sound like your cell is formatted to text - so to correct this select the cell, press Delete, right click, Format cells > Number tab select General, then carry on to the next question

    so first question is must I type the formula or can I copy and paste it?
    You can do either

    second question is when I type the formula must I be exact in pushing all three buttons at the same time?
    After you have you formula in the formula bar - Press Ctrl+Shift+Enter all three pressed down in that order.

    last, once (if i ever can) get this formula to work, can I copy and paste it to the remaining other 39 cells?
    If the next cell to lookup is in the next cell down - K3 then K4, then yes because your data table is a fixed range - $G$3:$J$41 - using the $ to fix it

  12. #12
    Registered User
    Join Date
    01-25-2008
    Posts
    19

    before I screamed and cried..



    I made sure the cell was set to general.
    I copied the formula and pressed control, then shift, then hit the enter button. I got an formula error box.

    erased, the data, copied and pasted it, then pressed control, shift and enter all at the same time.
    I got a formula error.

    erased the data, hand typed it, then pressed control and shift then hit enter.
    I got a formula error.

    erased the data, hand typed it then pressed control, shift and enter all at the same time.
    I got a formula error.

    then I screamed UGH! then sniffled a bit.... then I came back to the message board, lol.

    I am seriously missing something. I have tried to check my fields to make sure they are proper but at this point... I am lost.

    the number I am looking for is in field k2 on the sheet named test, the data ranges from column g3 to g41 on the csr data sheet. the percentages I need to average are in columns h3, i3 and j3 going down to h41, i41, and j41 on the csr sheet.

    so i start with the average formula because that is the result I want. I find the id in field k2 on the test sheet. I tell it to look in the range of g3:j41 of the csr data sheet, then it is suppose to find that id, then the three percentages adjacent to it and give me an average.

    How about I get a cup of hot chocolate, and scream again.

    You have been awesome, I just feel like an idiot about now.

    bpaw

  13. #13
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi,

    How about posting the data sheet if the data not to "sensitive" and I'l take a look for you. You have your hot chocolate.

    To post a zipped example, go to “My Documents” or wherever you have your file stored, right-click and “Send to > Compressed file”, then attach this zipped file to your post.

  14. #14
    Registered User
    Join Date
    01-25-2008
    Posts
    19

    Here is the sheet

    You can find the actual line i am working on on the instruction sheet number 10,

    line 59 on the excel sheet.

    thanks...
    bpaw
    Attached Files Attached Files

  15. #15
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211
    See the attached
    Attached Files Attached Files

  16. #16
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Well done Teethless mama,

    bpaw that why its aways best to post a sample first if you can, then everybody can see exactly what you're looking at.

  17. #17
    Registered User
    Join Date
    01-25-2008
    Posts
    19

    this works beautifuly except....

    The instructions are specifically requesting that I use vlookup.
    At this point I am wondering if it is possible to use vlookup and the average command in the same formula.


    bpaw

  18. #18
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    OK, try this just a straight forward ENTER formula

    =AVERAGE(VLOOKUP(K2,'CSR Data'!$G$3:$J$41,2),VLOOKUP(K2,'CSR Data'!$G$3:$J$41,3),VLOOKUP(K2,'CSR Data'!$G$3:$J$41,4))

  19. #19
    Registered User
    Join Date
    01-25-2008
    Posts
    19

    omg

    It works!!!

    I must have tried this formula at least 10 times.
    The difference was I was using : instead of , between the vlookup commands.

    You guy rock!!!
    Thank you.

    bpaw

  20. #20
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Glad you got the result you wanted, carry on with the rest now!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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