+ Reply to Thread
Results 1 to 9 of 9

LOOKUP won't count blank spaces

  1. #1
    Registered User
    Join Date
    10-25-2006
    Posts
    12

    Unhappy LOOKUP won't count blank spaces

    The development of my department tracking system (attached) has hit a snag and I would appreciate any ideas you may have, please, to resolve the problem.

    Assessment data is added as shown - 4A, 5C, etc, into columns N, O , P, Q, R and S. I am using a lookup table to convert that into a numerical value, with the intention of adding up the total average value, shown in column T. The problem is that, if there are blank cells within the range, it seems unable to add them up. For the first student, row 2, that is fine. For the other students, because their assessments are ongoing, hence there are blank cells, I am unable to get a running score.

    Hope all this makes sense.
    Attached Files Attached Files
    Last edited by aphid; 03-29-2007 at 03:56 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Try this formula in T2, copied down:

    Please Login or Register  to view this content.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    10-25-2006
    Posts
    12
    Many thanks for this. Worked treat. I have never used 'Match' before.

    It has, however, thrown up another issue....

    I added /6 at the end of the formula to take account of the number of assessments (6) that will eventually be added to the sheet for each student by the end of the year. However, the way it is at the moment, all assessment results, whether for one, three or all six, are divided by 6. What I really want is for an average of the actual assessments carried out and added to the sheet, which isn't always 6. Clearly, three assessments divided by 6 is not the accurate score. For that student it should be divided by 3. Is there a way of achieving this...so the formula divides the overall score by the number of assessments....which can range from none through to all six?

    Is there a solution to this, also...?

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Try

    =COUNTA(N2:S2)

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  5. #5
    Registered User
    Join Date
    10-25-2006
    Posts
    12
    Where would I put 'COUNTA' ...?

    =(IF(ISNUMBER(MATCH(N3,'LookUp Tables'!$A$2:$A$29)),LOOKUP(N3,'LookUp Tables'!$A$2:$B$29),0)+(IF(ISNUMBER(MATCH(O3,'LookUp Tables'!$A$2:$A$29)),LOOKUP(O3,'LookUp Tables'!$A$2:$B$29),0)+(IF(ISNUMBER(MATCH(P3,'LookUp Tables'!$A$2:$A$29)),LOOKUP(P3,'LookUp Tables'!$A$2:$B$29),0)+(IF(ISNUMBER(MATCH(Q3,'LookUp Tables'!$A$2:$A$29)),LOOKUP(Q3,'LookUp Tables'!$A$2:$B$29),0)+(IF(ISNUMBER(MATCH(R3,'LookUp Tables'!$A$2:$A$29)),LOOKUP(R3,'LookUp Tables'!$A$2:$B$29),0)+(IF(ISNUMBER(MATCH(S3,'LookUp Tables'!$A$2:$A$29)),LOOKUP(S3,'LookUp Tables'!$A$2:$B$29),0)))))))/6
    Attached Files Attached Files

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Replace /6 at the end with /COUNTA(N2:S2)

    VBA Noob

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,719
    My general rule of thumb is that if your formula obscures most of the worksheet.....it's too large....formula surgery required.....

    As you're trying to average the grades AVERAGE function is a candidate, e.g. in T2 copied down

    =AVERAGE(IF(ISNUMBER(MATCH(N2:S2,'LookUp Tables'!A$2:A$29)),LOOKUP(N2:S2,'LookUp Tables'!A$2:B$29),""))

    confirmed with CTRL+SHIFT+ENTER

    but probably a better option because

    1) it doesn't require your lookup table to be sorted
    2) it doesn't require CTRL+SHIFT+ENTER
    3) it won't return #DIV/0! if N2:S2 is empty
    4) it's shorter again

    =SUMPRODUCT(SUMIF('LookUp Tables'!A$2:A$29,N2:S2,'LookUp Tables'!B$2:B$29))/MAX(1,COUNTA(N2:S2))

  8. #8
    Registered User
    Join Date
    10-25-2006
    Posts
    12

    Talking

    Thanks, guys. You have both provided me with two really great options. Many thanks.

    Both options seem to work (I just need to test with a few examples) , i.e.

    Replacing /6 with /COUNTA(N2:S2)

    and....

    =SUMPRODUCT(SUMIF('LookUp Tables'!A$2:A$29,N2:S2,'LookUp Tables'!B$2:B$29))/MAX(1,COUNTA(N2:S2))

    The latter is clearly a much more precise solution. I just need to get my head around how it works....but it does.

  9. #9
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    I would go with DDL solution. He's the king of formulas

    Glad you got a solution

    VBA Noob

+ 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