+ Reply to Thread
Results 1 to 32 of 32

Vlookup, MAX and IF formula

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-30-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    142

    Vlookup, MAX and IF formula

    In a nutshell I am trying the write a forumula that will identify the highest number for a range of data.

    Basicaly I need to identify the highest number for a particular person, however the data I have will contain more than 1 person so as I see it I need to identify using an IF to determin if col a = Mr A then look at col b to see which is the highest number and identify that as the highest in col c

    Hope this makes sense.

    Thanks

    Ted

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Vlookup, MAX and IF formula

    Hi Ted

    Try

    =MAX(IF(A1:A100="Mr A",b1:b100))

    Usually you need to use this formula as an ARRAY...




    -- Array(CSE) { }, formulae are confirmed with Control+Shift+Enter.
    Not just Enter.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Forum Contributor
    Join Date
    08-30-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Vlookup, MAX and IF formula

    I have amend the forumlae to =MAX(IF(A2:A1650=A2,BO2:BO1650)) as 'Mr A' is in col A and the range where i want to identify the max number is in col BO, however I am returning ther Max for the whole data range and not just for the specified "Mr A"

    Thanks

  4. #4
    Valued Forum Contributor
    Join Date
    09-15-2011
    Location
    Chennai, India
    MS-Off Ver
    Excel 2010
    Posts
    436

    Re: Vlookup, MAX and IF formula

    Please attached a sample file & your desired result.
    Please click 'Add reputation', if my answer helped you.

  5. #5
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Vlookup, MAX and IF formula

    In A2 is "Mr A" ???

    If YES, just lock the formula....

    =MAX(IF($A$2:$A$1650=$A$2,$BO$2:$BO$1650))

    If not try in this way..

    =MAX(IF($A$2:$A$1650=A2,$BO$2:$BO$1650))

    OR else pls upload a small sample workbook.



    To attach a small sample workbook.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  6. #6
    Forum Contributor
    Join Date
    08-30-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Vlookup, MAX and IF formula

    Unfortunately I am unable to upload a file i keep getting a error probably my work sytem not allowing it. The formulae above work in exactly the same way as previously.

    The problem is that I have within the range of data Mr A, B C D and E the formula suggested is only finding the max number which applies across all Mr A, B C D and E and not just Mr A.

    Thanks

  7. #7
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Vlookup, MAX and IF formula

    ..the formula suggested is only finding the max number which applies across all Mr A, B C D and E and not just Mr A.
    Ted. Do you confirm the formula as an ARRAY formula as i suggested?

    -- Array(CSE) { }, formulae are confirmed with Control+Shift+Enter.
    Not just Enter.

    Pls test it as an ARRAY formula and let me know if you need to upload a sample for you!

  8. #8
    Forum Contributor
    Join Date
    08-30-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Vlookup, MAX and IF formula

    Sorry, my fault I have now entered as an Array formula and it has worked.

    Thanks for your help

  9. #9
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Vlookup, MAX and IF formula

    You are welcome and thanks for the feed back.

    As that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thank you.

  10. #10
    Forum Contributor
    Join Date
    08-30-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Vlookup, MAX and IF formula

    Sorry I have a further compliacation linked to this

    I think I need to apply the same type of array formula. I have now got a pivot table with my list of names Mr A to E, i need to do a look up from this pivot back to my original data. Efectively this will be an if to start with which is not a problem my problem arisies becasue I need to lookup the a column ( where Mr is and return a reference number which sits in col d ) but I need to fulfil 2 other conditions first where col e sates "exclude" and out of the rows flagged as exclude I need to find the max number in col f

    Hope this follows

    Thanks again

  11. #11
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Vlookup, MAX and IF formula

    Sorry Ted but i need a sample worksheet for this. If you have problem to do this from your work, do it from your home in the afternoon and i'll take a look there.

  12. #12
    Forum Contributor
    Join Date
    08-30-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Vlookup, MAX and IF formula

    Thanks probably won't be for another 7 hrs I will mock up a TEST sheet and upload it

  13. #13
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Vlookup, MAX and IF formula

    i'll be waiting..

  14. #14
    Forum Contributor
    Join Date
    08-30-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Vlookup, MAX and IF formula

    I have had a thought and tried to do this my self can I combine an "AND within the existing formula e.g.

    =MAX(IF(AND($A$2:$A$1650=A2,$BT$2:$BT$1650="exclude"),$BO$2:$BO$1650))

    Effectively return MAX on the condition that A2 is the same and BT = exclude ?

  15. #15
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Vlookup, MAX and IF formula

    You can use many condition for MAX(IF without use the AND function..

    =MAX(IF($A$2:$A$1650=A2,IF($BT$2:$BT$1650="exclude",$BO$2:$BO$1650)))
    Last edited by Fotis1991; 08-28-2013 at 06:45 AM.

  16. #16
    Forum Contributor
    Join Date
    08-30-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Vlookup, MAX and IF formula

    test.xlsx

    This the upload.

    Effectively If in the pivot the number of checks =0 I need to find a case that has been excluded aND IS THE HIGHEST SCORING FOR THAT PERSON

    Thanks again

    Ted

  17. #17
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Vlookup, MAX and IF formula

    Hoping that i got your goal, give a try to this ARRAY function.

    =IF(SUMPRODUCT(($A$2:$A$14=$G6)*($B$2:$B$14=$F$1));"";MAX(IF($A$2:$A$14=$G6;IF($B$2:$B$14=$G$1;$D$2:$D$14))))
    Comments?
    Attached Files Attached Files

  18. #18
    Forum Contributor
    Join Date
    08-30-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Vlookup, MAX and IF formula

    sorry I also need to return the ref no. in col c i.e for the example of 64 i would need to retrun a0006

    Thanks again

  19. #19
    Forum Contributor
    Join Date
    08-30-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Vlookup, MAX and IF formula

    Hi I have transposed what you have done to the actual sheet it now looks like this

    =IF(SUMPRODUCT(('July Scores'!$A$2:$A$1650=$A5)*('July Scores'!$BV$2:$BV$1650=$R$2)),"",MAX(IF('July Scores'!$A$2:$A$1650=$A$3,IF('July Scores'!$BV$2:$BV$1650=$R$3,'July Scores'!$BY$2:$BY$1650))))

    Something is working because where I have "checked cases" (i.e. a number in the check field) the field is blank as per your example, where there is a no cases checked i am returning 0 on all Mr's

    I have entered the forumal as an array

    Thanks

  20. #20
    Forum Contributor
    Join Date
    08-30-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Vlookup, MAX and IF formula

    Ok, I used the formula on the same sheet which is the "july Sheet" ststed in my formula in the post above and this now works, I'm not sure why this doesn't work accross sheets is this something to do with the fact that this is an array formula. I would however still like to return effectively col c.

    Thanks again

  21. #21
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Vlookup, MAX and IF formula

    So Ted.

    In I6 of my example, put this ARRAY formula...

    =INDEX($C$2:$C$14,MATCH(IF(SUMPRODUCT(($A$2:$A$14=$G6)*($B$2:$B$14=$F$1)),"",MAX(IF($A$2:$A$14=$G6,IF($B$2:$B$14=$G$1;$D$2:$D$14)))),$D$2:$D$14,0))
    This will gives you "a0006" as result.

  22. #22
    Forum Contributor
    Join Date
    08-30-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Vlookup, MAX and IF formula

    ok sorted it now, need to remeber the ctrl shift enter. As i said previously can i use the array forula across to sheets ?

  23. #23
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Vlookup, MAX and IF formula

    Quote Originally Posted by Ted Dennis View Post
    ok sorted it now, need to remeber the ctrl shift enter. As i said previously can i use the array forula across to sheets ?
    What to you mean? Some data in one sheet and some others to another sheet? YES you can.

  24. #24
    Forum Contributor
    Join Date
    08-30-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Vlookup, MAX and IF formula

    I have done this but its returning a #n/a.

    any ideas

  25. #25
    Forum Contributor
    Join Date
    08-30-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Vlookup, MAX and IF formula

    Obviously the initial Test was on 1 sheet, however when I tested it (see post above refering to 'July Scores' sheet) I was using 2 worksheets this didn't work I don't know why as there was no error it was just returning a 0 ? When I used the same as you did on one sheet it worked fine ? The other problem iis the Index function that you added fro me, this is not working, becasue where there is a repeat number in col D it keeps picking that up?

    Thanks again for your assistance

    Cheers

    Ted

  26. #26
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Vlookup, MAX and IF formula

    Ted

    You give me i by 1 new info and 1 day after the other(i mean we started at 28/08/2013 and now is 30/08/2013)..
    and without to show me some examples...You told:

    ..sorry I also need to return the ref no. in col c i.e for the example of 64 i would need to retrun a0006
    You didn't told that maybe will be many results....

    I like to continue to help you but:

    As i don't want to make 50 posts here, pls:

    Make a sample workbook to be exactly as your original. Ask for all the questions that you have. Show us what is that that don't work and pls don't do this after many hours-days. Then i'll not be able to support it.

    Thanks for understanding.

  27. #27
    Forum Contributor
    Join Date
    08-30-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Vlookup, MAX and IF formula

    Thanks for your understanding I will endeavour to try and sort this out in one go, unfortunately I will not be able to upload a sample until tomorrow. Then hopefully that will put the problem to bed.

    Thanks again for you help

    Cheers

  28. #28
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Vlookup, MAX and IF formula

    Good luck!

    Edit: I saw your other thread here..

    http://www.excelforum.com/excel-form...f-formula.html

  29. #29
    Forum Contributor
    Join Date
    08-30-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Vlookup, MAX and IF formula

    This was another part of the jigsaw but not what you were looking at for me.
    Cheers

  30. #30
    Forum Contributor
    Join Date
    08-30-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Vlookup, MAX and IF formula

    [ATTACH]262223[/ATTACH)

    I have attached the file hopefully this can sort out the issue

    Thanks

    Again
    Attached Files Attached Files

  31. #31
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Vlookup, MAX and IF formula

    Hi there.

    ...The other problem iis the Index function that you added fro me, this is not working, becasue where there is a repeat number in col D it keeps picking that up?

    ..I have attached the file hopefully this can sort out the issue
    We can fix it using this ARRAY formula.

    =INDEX($C$2:$C$14;MATCH(MAX(IF($A$2:$A$14=$G5;IF($B$2:$B$14=$G$1;$D$2:$D$14)))&$G5;$D$2:$D$14&$A$2:$A$14;0))
    Comments?
    Attached Files Attached Files

  32. #32
    Forum Contributor
    Join Date
    08-30-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    142

    Re: Vlookup, MAX and IF formula

    This works very well, thanks again
    Ted

+ 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. [SOLVED] VBA code for change vlookup formula to vlookup formula with ISNA
    By erprasannaa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2013, 03:33 AM
  2. Vlookup referencing a vlookup formula
    By laurenann in forum Excel General
    Replies: 1
    Last Post: 01-24-2011, 05:52 PM
  3. Replies: 4
    Last Post: 06-06-2010, 07:13 PM
  4. Replies: 2
    Last Post: 10-08-2009, 09:51 PM
  5. [SOLVED] vlookup-reate a vlookup formula?
    By Pam C in forum Excel General
    Replies: 1
    Last Post: 03-16-2006, 12:15 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