+ Reply to Thread
Results 1 to 7 of 7

Search for a cell value based on 2 references

  1. #1
    Registered User
    Join Date
    01-21-2013
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2003
    Posts
    20

    Search for a cell value based on 2 references

    Hi

    I have a sheet (sheet 1) of financial data for multiple buildings as follows:

    Building Budget Type Budget £

    Centre A Employees £1
    Centre A Premises £2
    Centre A Supplies £3
    Centre A Income £4
    Centre B Employees £5
    Centre B Premises £6
    Centre B Supplies £7
    Centre B Income £8
    Centre C Employees £9
    Centre C Premises £10
    Centre C Supplies £11
    Centre C Income £12
    etc, etc, etc

    As you can see, column A is in blocks (4 lines of the same name) and column B has repetitve lines over 4 lines.

    From another sheet (sheet 2), I wish to be able to specify a buidling (Centre B) and budget type (Supplies) and return the value in budget £ (£7)

    I was considering using VLOOKUP but the data is not sorted alphabetically and I really need to find a way to keep it in its original list.

    Any help would be much appreicated, thanks in advance

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

    Re: Search for a cell value based on 2 references

    if you are using XL2007 or later, try SUMIFS

    e.g

    =SUMIFS(Sheet1!$C$2:$C$20,Sheet1!$A$2:$A$20,A2,Sheet1!$B$2:$B$20,B2)

    where database is in Sheet1!A2:C20 and lookup values are in A2 and B2 for Building and Budget Type, respectively.

    Adjust ranges to suit.

    if using 2003 or earlier:

    =INDEX(Sheet1!$C$2:$C$100,MATCH(1,INDEX((Sheet1!$A$2:$A$20=A2)*(Sheet1!$B$2:$B$20=B2),0),0))
    Last edited by NBVC; 08-07-2013 at 09:03 AM. Reason: TYPO IN FORMULA
    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
    Valued Forum Contributor
    Join Date
    09-15-2011
    Location
    Chennai, India
    MS-Off Ver
    Excel 2010
    Posts
    436

    Re: Search for a cell value based on 2 references

    You can try this solution as well

    Pleas use it with Ctrl+Shift+Enter
    =INDEX(Sheet1!$C$1:$C$12,MATCH(A1&B1,Sheet1!$A$1:$A$12&Sheet1!$B$1:$B$12,0))
    Please click 'Add reputation', if my answer helped you.

  4. #4
    Registered User
    Join Date
    01-21-2013
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Search for a cell value based on 2 references

    These are great, thanks

    In some cells I return the error "#N/A" because that specific line doesn't exist. Is there a way of returning a value of "0" in these instances?

    Thanks again

  5. #5
    Registered User
    Join Date
    01-21-2013
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Search for a cell value based on 2 references

    I am using Excel 2003 by the way, so I am utilising the INDEX formula.

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Search for a cell value based on 2 references

    tRY:

    =LOOKUP(9.999999E+307,CHOOSE({1,2},0,INDEX(Sheet1!$C$2:$C$20,MATCH(1,INDEX((Sheet1!$A$2:$A$20=A2)*(Sheet1!$B$2:$B$20=B2),0),0))))

  7. #7
    Registered User
    Join Date
    01-21-2013
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Search for a cell value based on 2 references

    NBVC - you are a genius!!!

    Thank you so much

+ 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. Replies: 6
    Last Post: 03-06-2012, 11:11 AM
  2. Cell value based on three references cells
    By ChrisNor in forum Excel General
    Replies: 4
    Last Post: 04-17-2009, 07:26 AM
  3. return cell references based on criteria
    By blakeyoung in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-22-2008, 09:10 PM
  4. Changing File references based on cell value
    By CParnell in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-29-2007, 12:55 PM
  5. Return multiple cell references based on a search criteria
    By ruddocg in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-30-2006, 07:49 AM

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