+ Reply to Thread
Results 1 to 7 of 7

Referencing or lookup function possibly?

  1. #1
    Registered User
    Join Date
    01-17-2016
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    25

    Referencing or lookup function possibly?

    Hello,

    I'm looking for a formula that can pick out the number of votes a party receives in a constituency. If the Conservative party won the constituency, then I want the number of votes the party in second achieved, if the Conservative party lost the constituency, then I want the number of votes the winning party achieved. I've attached an excel file which should make this clearer.

    Thanks in advance for any help!
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor loginjmor's Avatar
    Join Date
    01-31-2013
    Location
    Cedar Rapids, Iowa
    MS-Off Ver
    Excel 2013
    Posts
    1,073

    Re: Referencing or lookup function possibly?

    Since the votes are in numerical order, you could simply use the following statement;

    =IF(C4="Conservative",E5,E4)

    Copy this into S4. Copy down to the next 3 cells and adjust the ranges. So for cell S5, change C4 to C8; E5 goes to E9 and E4 goes to E8. And so on.
    ____________________________________________
    If this has solved your problem, please edit the thread title to add the word [SOLVED] at the beginning. You can do this by
    -Go to the top of the first post
    -Select Thread Tools
    -Select Mark thread as Solved

    If I have been particularly helpful, please "bump" my reputation by pressing the small star in the lower left corner of my post.

  3. #3
    Registered User
    Join Date
    01-17-2016
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    25

    Re: Referencing or lookup function possibly?

    Thanks for the suggestion, I have thousands to do so need a less manual procedure though

  4. #4
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Referencing or lookup function possibly?

    Building off of loginjmor's idea, you can put the formula below in S4 and just fill down. It should cover you as you add more constituencies or even switch parties.

    =IF(VLOOKUP($M4,$B:$D,3,FALSE)=$N4,INDEX($E:$E,MATCH($M4,$B:$B,0)+1),VLOOKUP($M4,$B:$E,4,FALSE))

  5. #5
    Registered User
    Join Date
    01-17-2016
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    25

    Re: Referencing or lookup function possibly?

    This is very close to working except it always seems to return the votes of the winning party, even when the winning party is the Conservative party. If the Conservatives are winning I would like the 2nd placed number of votes to be produced. Is it possible to adjust the formula slightly to make this happen? My idea would be to reference one below but I'm unsure how to do this?

  6. #6
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Referencing or lookup function possibly?

    Duh. Sorry. Fixed:

    =IF(VLOOKUP($M4,$B:$C,2,FALSE)=$N4,INDEX($E:$E,(MATCH($M4,$B:$B,0)+1)),VLOOKUP($M4,$B:$E,4,FALSE))

    Enter in S4 and fill down

  7. #7
    Registered User
    Join Date
    01-17-2016
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    25

    Re: Referencing or lookup function possibly?

    Thanks, this is exactly what I was after!

+ 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. Dynamic Lookup function referencing other cells for address
    By jmmac in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-07-2016, 04:47 PM
  2. [SOLVED] Lookup function question for referencing cells
    By lilsnoop in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-01-2016, 02:41 AM
  3. Need an array possibly INDEX/MATCH formula with multiple lookup criteria.
    By TheClaw2323 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-25-2015, 09:59 AM
  4. Don't know where to start - lookup function with ifs possibly?
    By courtie89 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-19-2015, 03:48 PM
  5. [SOLVED] Looking for a formula - possibly V or H Lookup or MATCH?
    By Clare1234 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-17-2013, 06:53 AM
  6. possibly a lookup function question, not sure
    By mufan in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-11-2008, 09:46 PM
  7. [SOLVED] Lookup possibly?
    By SS in forum Excel General
    Replies: 3
    Last Post: 01-06-2005, 10:06 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