+ Reply to Thread
Results 1 to 7 of 7

Mutil-critieria XLookUp with range is concacted together - not working

  1. #1
    Registered User
    Join Date
    09-19-2016
    Location
    Muscat, Oman
    MS-Off Ver
    365
    Posts
    56

    Mutil-critieria XLookUp with range is concacted together - not working

    I am updating my Index/Match formulas to the new XLookup. My newly revised formula is this and works fine:
    Please Login or Register  to view this content.
    Basically it is saying when the date is less than Y3 and the date is greater than C3, then depending on H3, return when the K is > CN3 or L number < CN3. Return the first match's date.

    Since I have 22 different worksheets (EURUSD is one of the 22), and every week I add to the worksheets. With the above formula I have to change the worksheet name and have to update the last row (in above case it is 100286).

    So I created a concactate formula to replace "EURUSD!$A$3:$A$100286" with a dynamic one that will change with the worksheet name and number of rows automatically.

    Here is what I came up with:
    Please Login or Register  to view this content.
    I also tried CONCATENATE($G3,"!$A$3:$A$",$U$1), but same results, neighter one works. If I put the CONCATENATE($G3,"!$A$3:$A$",$U$1) in a cell, it will result in "EURUSD!$A$3:$A$100286". So that works.

    So what am I doing wrong that it will not read my concatenate correctly? I appreicate your advice in advance.

  2. #2
    Forum Contributor
    Join Date
    08-12-2020
    Location
    Atlanta, Georgia
    MS-Off Ver
    Office 16
    Posts
    241

    Re: Mutil-critieria XLookUp with range is concacted together - not working

    If CONCATENATE($G3,"!$A$3:$A$",$U$1) gives you the equation you are looking for try INDIRECT(CONCATENATE($G3,"!$A$3:$A$",$U$1)) If it does not work then check the fx on the formula bar to see what it is "understanding" and adjust your concatenate to the correct format.

  3. #3
    Registered User
    Join Date
    09-19-2016
    Location
    Muscat, Oman
    MS-Off Ver
    365
    Posts
    56

    Re: Mutil-critieria XLookUp with range is concacted together - not working

    Quote Originally Posted by Squeaky View Post
    If CONCATENATE($G3,"!$A$3:$A$",$U$1) gives you the equation you are looking for try INDIRECT(CONCATENATE($G3,"!$A$3:$A$",$U$1)) If it does not work then check the fx on the formula bar to see what it is "understanding" and adjust your concatenate to the correct format.
    Thank you for the few suggestions.

    Indirect gives a !Spill.

    I loaded in fx by itself, and attached is the result. It looks good, but it is surrounded by " ". I was thinking that could be the problem. It sees it as text and not a valid range reference. Could that be it?
    Attached Images Attached Images

  4. #4
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Mutil-critieria XLookUp with range is concacted together - not working

    This site is acting up, so I have to avoid using the less than character.

    If you have XLOOKUP, your Excel version isn't 2010.

    If you have XLOOKUP, you should also have FILTER. FILTER is more useful than XLOOKUP. By far.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    If there were multiple rows satisfying the criteria, FILTER would return them all. Thus the need for the INDEX(FILTER(...),1) call to return the 1st one. If there are no rows satisfying the criteria, FILTER with no 3rd argument returns the new #CALC! error, and IFERROR converts that into "Not Found". The advantage of using FILTER is that you'd have the option of also returning the 2nd, 3rd, etc rows satisfying the criteria.

    As for adding more rows to worksheets, you could use worksheet-level defined names. For example, if there should be dates in col A for all rows with data, define Bottom for worksheet EURUSD referring to the formula =MATCH(1,0/ISNUMBER(EURUSD!$A$3:$A$1048576)), and define Dates for worksheet EURUSD referring to the formula =EURUSD!$A$3:INDEX(EURUSD!$A$3:$A$1048576,Bottom). Similarly for the other columns. For my own simplicity I'll use ColK and ColL for the ranges in columns K and L. Then

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    As for using different worksheets, you could do that with 1) a list of worksheet names and 2) workbook-level names. Assuming the list of worksheet names were in a range with workbook-level name WSListG (the G stands for Global, meaning workbook scope) looking something like

    CADEUR
    CADUKP
    CADUSD
    EURUKP
    EURUSD
    UKPUSD

    and so on. I'll assume the worksheet name you want to use is in cell whatever!D1, where whatever should be replaced by the name of the worksheet in which you're entering these formulas. I'd recommend using a workbook-level defined name WSIndexG referring to the formula =MATCH(whatever!$D$1,WSListG,0). Then workbook-level defined names like DatesG referring to the formula

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Then change the FILTER formula to

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    The point of all this is to avoid INDIRECT or other volatile functions. I figure you'd need a fair number of these formulas, and each of those INDIRECT calls referring to ranges of more than 100,000 rows would KILL recalc performance. What's above is the best way I've found to avoid volatile functions for dynamic worksheet addressing for a KNOWN or KNOWABLE set of worksheets. The main thing to understand is that the appearance of ranges (names of actual references) in CHOOSE function calls must match the order of worksheet names in WSListG.

  5. #5
    Registered User
    Join Date
    09-19-2016
    Location
    Muscat, Oman
    MS-Off Ver
    365
    Posts
    56

    Re: Using auto calculating range in formulas

    Quote Originally Posted by hrlngrv View Post

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    If there were multiple rows satisfying the criteria, FILTER would return them all. Thus the need for the INDEX(FILTER(...),1) call to return the 1st one. If there are no rows satisfying the criteria, FILTER with no 3rd argument returns the new #CALC! error, and IFERROR converts that into "Not Found". The advantage of using FILTER is that you'd have the option of also returning the 2nd, 3rd, etc rows satisfying the criteria.

    As for adding more rows to worksheets, you could use worksheet-level defined names. For example, if there should be dates in col A for all rows with data, define Bottom for worksheet EURUSD referring to the formula =MATCH(1,0/ISNUMBER(EURUSD!$A$3:$A$1048576)), and define Dates for worksheet EURUSD referring to the formula =EURUSD!$A$3:INDEX(EURUSD!$A$3:$A$1048576,Bottom). Similarly for the other columns. For my own simplicity I'll use ColK and ColL for the ranges in columns K and L. Then

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Thank you for the detailed suggestions.

    I agree about Indirect.

    As for xlookup, everywhere I read about it, it says its faster than index/match, which is what I was using previously. I was not aware of filter, I appreciate you sharing that. I will actually compare the speed of the two. Its interesting to investigate it further.

    As for the defined names. The problem is I have 136 columns that are referenced. Thus, I would need to maintain 136 defined names. As in your formula, you do have a defined end row that is used to find the bottom. The problem for myself personally is I know myself and some day in the future, my data will exceed that end row in the formula, and I will be confused why my formulas are not working.

    That is why I wanted one cell that I have CountA auto calculating the last row of the sheet. Then, I want to use that in the formulas. That way it is done automatically and I don't have to remember to do anything. I tried to Concatenate and textjoijn, but it doesn't work in this case (I don't know why, but maybe its yeilding a string, which causes problems). When I take the string that comes from the result of concatentate forumla and put that in Xlookup or Filter, it works just fine.

    --edited---
    I was able to achieve one of my objectives (auto counting rows) with using this as the cell reference in the formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    (U1 is the total non-blank rows with a formula that auto counts the rows on EURUSD sheets). I guess that is okay, because I can satisfy the other objective by just use replace function to change the worksheet name.

    Thanks for the suggestions. To be honest, while the solution I am using is not one of the suggestions, I would not have arrived at it without the discourse here. Plus, I can't wait to check out the Filter function and see how that works!
    Last edited by stearno; 10-07-2020 at 04:44 AM.

  6. #6
    Forum Contributor
    Join Date
    08-12-2020
    Location
    Atlanta, Georgia
    MS-Off Ver
    Office 16
    Posts
    241

    Re: Mutil-critieria XLookUp with range is concacted together - not working

    I looked at some of my indirect formulas and what I see is mine also have the "" around them and they work. What I do not see in yours is the ' marks around 'Eurusd'. inside the indirect formula put "'"&$G4&"'"&"!A$3:$a$"&$U$1
    While it is true if you have many indirect formulas it will cause a slowdown, a few may not. You can only see how it works on your spreadsheet to determine that.

  7. #7
    Registered User
    Join Date
    09-19-2016
    Location
    Muscat, Oman
    MS-Off Ver
    365
    Posts
    56

    Re: Mutil-critieria XLookUp with range is concacted together - not working

    Quote Originally Posted by Squeaky View Post
    I looked at some of my indirect formulas and what I see is mine also have the "" around them and they work. What I do not see in yours is the ' marks around 'Eurusd'. inside the indirect formula put "'"&$G4&"'"&"!A$3:$a$"&$U$1
    While it is true if you have many indirect formulas it will cause a slowdown, a few may not. You can only see how it works on your spreadsheet to determine that.
    Oh wow, Squeaky. Good eye. You are right, that was the problem. Thank you very 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. Help to copy mutil sheets to Exist file
    By Excel-Newbe in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-31-2017, 09:08 AM
  2. Advanced filter with dynamic critieria range
    By kilvan99 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-14-2014, 02:29 PM
  3. Replies: 7
    Last Post: 12-16-2011, 11:31 AM
  4. HOW TO Sum a dynamic range according to critieria
    By shivpreet2k1 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 08-21-2009, 05:28 AM
  5. Day of week concacted from three cells
    By MABeatty in forum Excel General
    Replies: 2
    Last Post: 07-12-2006, 08:50 AM
  6. [SOLVED] Pull mutil values from one LOOKUP formula
    By Sonic in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-13-2006, 06:00 PM
  7. Maximum selections in a mutil list box
    By Martin in forum Excel General
    Replies: 1
    Last Post: 10-18-2005, 06:05 PM

Tags for this Thread

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