+ Reply to Thread
Results 1 to 14 of 14

INDIRECT within a LOOKUP

  1. #1
    Registered User
    Join Date
    12-07-2015
    Location
    Umerica
    MS-Off Ver
    2007
    Posts
    36

    INDIRECT within a LOOKUP

    excel.jpg

    My original formula looks like this.
    =LOOKUP(2,1/COUNTIF(SHEET1!A1,{"TEST1","TEST2"}),{"T1","T2"})

    And this works fine but I would like to use the INDIRECT function inside this LOOKUP function. So it would work like this formula.
    =LOOKUP(2,1/COUNTIF(SHEET1!A1,{"INDIRECT("D1")","INDIRECT("D1")"}),{"T1","T2"})

    I know this second formula is not correct but I am not sure how to get this to work.
    Thanks for any help.

    TESTBOOK1.xlsx

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: INDIRECT within a LOOKUP

    Hi.

    Why INDIRECT? Simply:

    =LOOKUP(2,1/COUNTIF(SHEET1!A1,D1:D2),{"T1","T2"})

    Also, can I ask why the complex solution? It's certainly nice to see, and a useful one in many (arguably more relevant) situations, but what's wrong with:

    =IF(A1="TEST1","T1","T2")

    ?

    Or are you in fact not presenting us with your actual formula, but merely with a concocted example to illustrate your query?

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: INDIRECT within a LOOKUP

    Quote Originally Posted by strik009 View Post
    ... but I would like to use the INDIRECT function inside this LOOKUP function...
    Why do you want to use INDIRECT inside the function?

    Array constants (i.e. enclosed with the curly brackets) can not contain cell references or formulae.

    Pete

  4. #4
    Registered User
    Join Date
    12-07-2015
    Location
    Umerica
    MS-Off Ver
    2007
    Posts
    36

    Re: INDIRECT within a LOOKUP

    Yes that is exactly rite XOR LX this is a simpler version of a more complex formula. I had another post on here that now one could seem to understand what it was I was trying to do.
    Now that I have simplified this seems ( with your help ) I have finally gotten somewhere.
    My actual formula looks like this.

    =IF(SHEET1!A2="","",IFERROR(LOOKUP(2,1/COUNTIF(OFFSET('DATA'!$A$1,(ROWS($1:1)-1)*3,0),{"test1","test2","test3","test4"}),{"t1","t2","t3","t4"}),"UNK"))

    I am looking for a way to manually change test1, test 2........ and t1, t2.......
    I have another page that is called RULES I want the user to be able to change the info inside those cells and it reflect in this formula.
    So D1:D4 (test1 : test4) and E1:E4 ( t1 :t4 ) are on the rules sheet ( RULES ) and the other sheets are ( SHEET1 ) and ( DATA ).

    Do you think you can help me further by showing me how to to the same to the second part of the formula ... this part
    {"t1","t2","t3","t4"})

    Thanks again for your help.

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: INDIRECT within a LOOKUP

    So why can't you just replace:

    {"test1","test2","test3","test4"}

    with:

    RULES!D1:D4

    and:

    {"t1","t2","t3","t4"}

    with:

    RULES!E1:E4

    within the formula you give?

    Regards

  6. #6
    Registered User
    Join Date
    12-07-2015
    Location
    Umerica
    MS-Off Ver
    2007
    Posts
    36

    Re: INDIRECT within a LOOKUP

    Man is it really that simple?
    I admit I am new at Excel and formulas perhaps I overcomplicated I will try your suggestion.
    I hope it works.

  7. #7
    Registered User
    Join Date
    12-07-2015
    Location
    Umerica
    MS-Off Ver
    2007
    Posts
    36

    Re: INDIRECT within a LOOKUP

    ok so the formula is not quite working.
    I believe because RULES!D1:D4 is to match with RULES!E1:E4
    But the formula (I think) is not associating D1 with E1, D2 with E2, D3 with E3, D4 with E4 specifically.
    I will attach my workbook so you can see.

    TESTBOOK1.xlsx

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: INDIRECT within a LOOKUP

    Thanks, but can't see any new formulas in here?

    Regards

  9. #9
    Registered User
    Join Date
    12-07-2015
    Location
    Umerica
    MS-Off Ver
    2007
    Posts
    36

    Re: INDIRECT within a LOOKUP

    Oh ok so its all in the work book but here this is the idea.
    =IF(SHEET1!B1="","",IFERROR(LOOKUP(2,1/COUNTIF(OFFSET(DATA!$A$1,(ROWS($1:1)-1)*3,0),RULES!$D$1:$D$4),RULES!$E$1:$E$4),"UNK"))
    Is the formula I put in SHEET1 A1.

    and it seems to work....
    but then I put this formula in SHEET1 A2.
    =IF(SHEET1!B2="","",IFERROR(LOOKUP(2,1/COUNTIF(OFFSET(DATA!$A$4,(ROWS($1:1)-1)*3,0),RULES!$D$1:$D$4),RULES!$E$1:$E$4),"UNK"))
    and it comes up and UNK.

    I get the same problem for the next two formulas inside A3 and A4, they come up as UNK
    =IF(SHEET1!B3="","",IFERROR(LOOKUP(2,1/COUNTIF(OFFSET(DATA!$A$7,(ROWS($1:1)-1)*3,0),RULES!$D$1:$D$4),RULES!$E$1:$E$4),"UNK"))
    =IF(SHEET1!B4="","",IFERROR(LOOKUP(2,1/COUNTIF(OFFSET(DATA!$A$10,(ROWS($1:1)-1)*3,0),RULES!$D$1:$D$4),RULES!$E$1:$E$4),"UNK"))

    I think its because its not specifically matching RULES D2, to E2 and D3 to E3 and D4 to E4.
    I think perhaps because the ( : ) kinda messes that up? I think?

  10. #10
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: INDIRECT within a LOOKUP

    So have you updated your workbook with these new formulas?

    Regards

  11. #11
    Registered User
    Join Date
    12-07-2015
    Location
    Umerica
    MS-Off Ver
    2007
    Posts
    36

    Re: INDIRECT within a LOOKUP

    Yes. The first field works but after that I get UNK.
    I am thinking perhaps something like
    =IF(SHEET1!B1="","",IFERROR(LOOKUP(2,1/COUNTIF(OFFSET(DATA!$A$1,(ROWS($1:1)-1)*3,0),RULES!D1,D2,D3,D4),RULES!E1,E2,E3,E4),"UNK"))
    ?
    I'll try that

  12. #12
    Registered User
    Join Date
    12-07-2015
    Location
    Umerica
    MS-Off Ver
    2007
    Posts
    36

    Re: INDIRECT within a LOOKUP

    No that did not work at all.

  13. #13
    Registered User
    Join Date
    12-07-2015
    Location
    Umerica
    MS-Off Ver
    2007
    Posts
    36

    Re: INDIRECT within a LOOKUP

    Dont give up on me now?

  14. #14
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: INDIRECT within a LOOKUP

    Sorry, but I still can't see any of these new attempts in either of the workbooks you've posted.

    Regards

+ 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. Two Way Lookup With Indirect
    By pookyman in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-22-2015, 02:12 PM
  2. Lookup with an indirect
    By amartino44 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-06-2013, 01:01 PM
  3. [SOLVED] Lookup help using INDIRECT
    By Kuehl5000 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-20-2013, 05:24 PM
  4. Indirect lookup
    By kborgers in forum Excel General
    Replies: 7
    Last Post: 11-07-2012, 03:49 PM
  5. Indirect + Lookup last value
    By slyzenoui in forum Excel General
    Replies: 2
    Last Post: 03-24-2007, 04:09 PM
  6. Lookup v Indirect
    By freekrill in forum Excel General
    Replies: 1
    Last Post: 09-26-2006, 01:45 PM
  7. [SOLVED] indirect lookup
    By choice in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-26-2005, 09:06 PM

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