+ Reply to Thread
Results 1 to 5 of 5

Using IF with LOOKUP

Hybrid View

  1. #1
    Registered User
    Join Date
    10-25-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    26

    Using IF with LOOKUP

    I was wondering if anybody was able to help I have attached a formula I need a hand with.

    =LOOKUP($J$6,Calculations!$A$1:$A$100,Calculations!$H$1:$H$100)
    If I wanted to add to this code that in Cell A1 for example there is either the value 1 or 2 - can I add an IF statement to the above code for example - IF cell A1 = 1 then as per the code above but if A1 =2 then the LOOKUP ranges would be different i.e. instead of....
    Calculations!$A$1:$A$100,Calculations!$H$1:$H$100 it would be Calculations!$B$1:$B$100,Calculations!$I$1:$I$100
    Is that to many arguments if so is there anyway I can work around it?

    Thank you for looking

    Gally

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Using IF with LOOKUP

    Try

    =LOOKUP($J$6,CHOOSE($A$1,Calculations!$A$1:$A$100,Calculations!$B$1:$B$100),CHOOSE($A$1,Calculations!$H$1:$H$100,Calculations!$I$1:$I$100))
    or
    =IF(A1=1,LOOKUP($J$6,Calculations!$A$1:$A$100,Calculations!$H$1:$H$100),IF(A1=2,LOOKUP($J$6,Calculations!$B$1:$B$100,Calculations!$I$1:$I$100),""))
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Using IF with LOOKUP

    How about

    =CHOOSE(A1,
         LOOKUP($J$6,Calculations!$A$1:$A$100,Calculations!$H$1:$H$100),
         LOOKUP($J$6,Calculations!$B$1:$B$100,Calculations!$I$1:$I$100))
    HTH
    Regards, Jeff

  4. #4
    Registered User
    Join Date
    10-25-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Using IF with LOOKUP

    Hi Ace_XL and Jeff - thank you both for taking the time to reply. I ended up using the second suggestion by Ace the =IF.

    All the suggestions much appreciated though.

    Kind Regards
    Gally

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Using IF with LOOKUP

    You're welcome and thanks for the feedback. Glad it worked out for you and we are happy to have helped...

+ 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