+ Reply to Thread
Results 1 to 4 of 4

Lookup depending on variable

Hybrid View

  1. #1
    Registered User
    Join Date
    01-06-2013
    Location
    Kent, England
    MS-Off Ver
    Excel 2010
    Posts
    1

    Lookup depending on variable

    Hi,
    I hope you can help.

    I have a spreadsheet that I use for keeping track of birds that I and three other people ring. Each row contains species name, Location and who ringed it amongst other things. I have the formula below that I use to count the unique number of species that we have ringed, from the total number of animals that we have ringed. (Column E is called "species").

    =SUM(IF(FREQUENCY(IF(LEN('2012'!E2:E399)>0,MATCH('2012'!E2:E399,'2012'!E2:E399,0),""), IF(LEN('2012'!E2:E399)>0,MATCH('2012'!E2:E399,'2012'!E2:E399,0),""))>0,1))

    This works fine for an overall total but it would also be good if I could either filter or calculate the results by person's initals which is contained in another field. Is it possible to do this? Essentially I guess I am saying can I run the above formula only when the cell that contains the name = "KP"?

    thanks

  2. #2
    Forum Contributor dogberry's Avatar
    Join Date
    07-15-2012
    Location
    Wales, UK
    MS-Off Ver
    Excel 2010
    Posts
    624

    Re: Lookup depending on variable

    Hi

    Would it not be simpler and less prone to error or inadvertant change if you converted your range to a table then you can search on whatever you choose with no complicated formulas.

    Chris
    Click my star if I helped Thanks

  3. #3
    Forum Expert icestationzbra's Avatar
    Join Date
    01-07-2004
    MS-Off Ver
    2007, 2010
    Posts
    1,421

    Re: Lookup depending on variable

    sans a sample workbook, this ARRAY formula is the best i can come up with, assuming that the "initials" column spans F2:F399:

    =SUM(IF(FREQUENCY(IF(LEN('2012'!E2:E399)*('2012'!F2:F399="KP"),MATCH('2012'!E2:E399,'2012'!E2:E399,0)), ROW('2012'!E2:E399)-MIN(ROW('2012'!E2:E399))+1),1))
    - i.s.z -
    CSE, aka Array aka { }, formulae are confirmed with CONTROL+SHIFT+ENTER.
    Replace commas ( , ) with semicolons ( ; ) in formulae, if your locale setting demands.
    All good ideas are courtesy resources from this forum as well as others around the web.
    - e.o.m -

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Lookup depending on variable

    Like this...

    A2:A399 = someones initials

    =SUM(IF(FREQUENCY(IF('2012'!E2:E399<>"",IF('2012'!A2:A399="XX",MATCH('2012'!E2:E399,'2012'!E2:E399,0))),ROW('2012'!E2:E399)-ROW('2012'!E2)+1),1))

    Replace the "XX" with the initials or better yet, put the initials in a cell and refer to that cell.

    Don't forget... array enter!
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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