+ Reply to Thread
Results 1 to 14 of 14

Complex Formula Algorithm (Variable size array created from index/match/adress returns)

  1. #1
    Registered User
    Join Date
    09-19-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    45

    Exclamation Complex Formula Algorithm (Variable size array created from index/match/adress returns)

    Hi, im not sure how to explain the situation so bear with me and thank you for looking,

    Im trying to create something extremely complex, ive searched over the internet cant find anything similar, so i decided to make it in parts, dissasemble the formula into 6 different parts, then find each part individually on the internet, for the most part i had good success until i got to the point where i need to create a variable sized and location array, ill explain more in formula format:

    Ok so basically goes something like this:

    Im trying to create a data parser to parse an xml dump file in order to process all the data, search for specific variables in the table, then within the results of that table, search for specific strings, and then return the values of those strings on another page, effectively delivering a clean "output" so to speak without all the extra useless XML code so that the info can then be fed into a spreadsheet for other uses.

    The original data in the XML table looks something like this:

    ID lvar Data
    65464 type B002344
    65464 flags 2131898
    65464 brand Airlink101
    65464 model AR504
    65464 tr69 Yes
    235422 type C002311
    235422 flags 33123144
    235422 brand BKTR
    235422 model BK20031

    The ID area is basically the unique unit or product identifier, and the lvars are the products different features, data is the relevant data from those features.

    So essentially what want it to do is:

    First search the entire file on column A for Similar ID Numers, from that somehow parse and identify them into one array (say it found 10 entries contanining the same ID number in range $:R37:R48), the lvars are not always the same, some have more and some have less so a match+10 from the first id "hit" wouldnt work, essentially it needs to generate an array that varies in size from product id to id, (and if possible that can fetch info even if its not sequential (random order), IE $R37:$R40 - $R44:$R7), once thats done (and this is the part ive already got working and nailed down with the following formula,=INDEX($D:$H,MATCH($C15,!$H:$H,0),MATCH(G$12,$D$12:$H$12,0)) it needs to find the data assigned to every lvar string and parse it in a different format in another worksheet.

    This part as i said i already got working fine, the problem im getting is with the original parsing of ids, ive tried several methods to no avail, the most promising method ive found so far (but sadly is vulnerable to corruption if the data is not sorted correctly(randomly ordered), which i can fix with a quick pre-sorting before pasting the info in the worksheet) is to use basically the same formula i use to parse the lvars but instead of telling it to search the whole array, i tell it to search from the first match found of the ids to the last using these 2 formulas:

    This finds me the first cell where the ID was seen: =VLOOKUP(E12,!$D:$D,1,0)
    And this finds me the last cell: =INDEX($D:$D,MATCH(E12,$D:$D,0),1)

    From that i could theoretically construct a "variable sized and location array" however every method ive tried to extract the exact adress location from those formulas has failed.

    If i try: =ADDRESS(MATCH(E16,D12:D34,0),1,1) I get something like $A$5 even tho its blatantly obvious the data is somwhere around $R50 and nowhere near $A$5, the match adress return seems to be relative to the location inside the array and not the entire worksheet.

    Trying to select the entire worksheet as a search area only returns a N/A Error so thats also out of the question :/

    So basically theres my two problems, if anyone has a good idea how to do this, or simply how to get a simple correct worksheet relative adress return for the information im trying to retrieve i would be most apreciated, with the latter i should be able to devise a solution for the variable array!

    Thanks for the responses in advance!
    Last edited by XionicFire; 01-23-2016 at 12:16 AM. Reason: typos

  2. #2
    Registered User
    Join Date
    09-19-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    45

    Re: Complex Formula Algorithm (Variable size array created from index/match/adress returns

    S1.png
    S2.png

    Images of the state of the spreadsheet

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Complex Formula Algorithm (Variable size array created from index/match/adress returns

    Please upload a sample of your workbook, not a picture of your data. Pictures are pretty much impossible to edit, and no-one wants to re-type your data for you
    Also, not all members can upload picture files (Company firewalls and stuff) - and, depending on what browser is being used, some pics dont even show up on the forum

    Your workbook should show a small desensitized example of the data you are working with and a manual mockup of the expected results.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    09-19-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    45

    Thumbs up Re: Complex Formula Algorithm (Variable size array created from index/match/adress returns

    Demo Sheet.xlsx

    Sorry i had no idea you could attach the spreadsheets (or that people preffered that)

    I have created a mini version of what were trying to do, removed all the useless stuff and multi worksheet links and left it preety straight forward.

    Let me know if theres anything that needs explaining but i think its preety self explanatory.

    Thanks for the help!

  5. #5
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Complex Formula Algorithm (Variable size array created from index/match/adress returns

    D14
    Please Login or Register  to view this content.
    Try this and copy across
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  6. #6
    Registered User
    Join Date
    09-19-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    45

    Re: Complex Formula Algorithm (Variable size array created from index/match/adress returns

    Well holy %@# that did the trick perfectly.. i have no idea how you did it haha, ill probably spend the next 2 hours figuring it out and reverse engineering that formula to figure how to apply it to the real document but it is quite impressive.

    Ill do some testing to see if it passes the "dumb user messing with the tables" & the "what if i use it over here" test but from the design it seems fairly simple and elegant, ill give it a thorough testing and let you know if it did the job on all counts.

    Thanks so much, ive been breaking my head for 6 hours on this!

  7. #7
    Registered User
    Join Date
    09-19-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    45

    Re: Complex Formula Algorithm (Variable size array created from index/match/adress returns

    Quote Originally Posted by nflsales View Post
    D14
    Please Login or Register  to view this content.
    Try this and copy across
    Ok i just spent a while testing it and its looks good, it passes all tests with flying colors, its sturdy and excel doesnt lag and crash when running it, thank you so much.

    On another note, theres one thing i tried but could not get to work with the formula,

    Currently the formula is like this:

    =IFERROR(IF(LEN(INDEX($G$56:$G$200,MATCH(D$12&$C14,INDEX($D$56:$D$117&$H$56:$H$200,0),0)))=0,"",INDEX($G$56:$G$200,MATCH(D$12&$C14,INDEX($D$56:$D$117&$H$56:$H$200,0),0))),"")

    If you notice it caps out at 200, but the actual document has around 38,000 entries, and its lenght might change dynamically, i changed it to:

    =IFERROR(IF(LEN(INDEX($G$56:$G$100000,MATCH(D$12&$C14,INDEX($D$56:$D$100000&$H$56:$H$100000,0),0)))=0,"",INDEX($G$56:$G$100000,MATCH(D$12&$C14,INDEX($D$56:$D$100000&$H$56:$H$100000,0),0))),"")

    And the formula works, but seems such a crude fix for something thats working so elegantly

    Is there any way to add a: "To infinity" or "autosize" to it?

    Basically be something like:

    =IFERROR(IF(LEN(INDEX($G$56:$G$,MATCH(D$12&$C14,INDEX($D$56:$D$&$H$56:$H$,0),0)))=0,"",INDEX($G$56:$G$,MATCH(D$12&$C14,INDEX($D$56:$D$&$H$56:$H$,0),0))),"")

    I tried doing this:

    =IFERROR(IF(LEN(INDEX($G$56:INDEX($G:$G,ROWS($G:$G)),MATCH(D$12&$C14,INDEX($D$56:INDEX($G:$G,ROWS($G:$G))&$H$56:INDEX($G:$G,ROWS($G:$G)),0),0)))=0,"",INDEX($G$56:INDEX($G:$G,ROWS($G:$G)),MATCH(D$12&$C14,INDEX($D$56:INDEX($G:$G,ROWS($G:$G))&$H$56:INDEX($G:$G,ROWS($G:$G)),0),0))),"")

    But had no luck :/

    Any ideas?


    :INDEX($G:$G,ROWS($G:$G))

  8. #8
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Complex Formula Algorithm (Variable size array created from index/match/adress returns

    D14
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    09-19-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    45

    Re: Complex Formula Algorithm (Variable size array created from index/match/adress returns

    Quote Originally Posted by nflsales View Post
    D14
    Please Login or Register  to view this content.
    Worked like a charm! that did it perfectly, im still trying to figure out how it works haha but i can tell you it works even from different sheets.

    Thanks so much!!!

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Complex Formula Algorithm (Variable size array created from index/match/adress returns

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

  11. #11
    Registered User
    Join Date
    09-19-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    45

    Re: Complex Formula Algorithm (Variable size array created from index/match/adress returns

    Hi,

    I did not know the fine details of cross posting, The reason i posted the "solution" and not the link on the other forums so to speak was just in case anyone searched only that forum they would also find the solution without leaving it open, it was merely to help out future excelers that might run into a similar problem find the solution faster.

    I am sorry , i am new to the whole excel forum post scene somewhat but will be more mindful of it in the future.

    The question was posted on only 3 forums, and we got very distinct answers on each one

    Here are the links:

    http://www.mrexcel.com/forum/excel-q...s-returns.html
    http://www.excelforum.com/excel-form...s-returns.html
    http://www.ozgrid.com/forum/showthre...904#post763904

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Complex Formula Algorithm (Variable size array created from index/match/adress returns

    Thanks for sharing that. The reason we - and most other forums - insist that you share links to other sites you asked the same question, was so that we don't all waste our time working on something that may already have been resolved some place else...Im sure you can understand

  13. #13
    Registered User
    Join Date
    09-19-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    45

    Re: Complex Formula Algorithm (Variable size array created from index/match/adress returns

    Completely and it makes total sense, i was going under the premise that "generally" on the internet websites dont like when you make links to other similar sites even if it would be useful, thus i figured posting links would be a really bad idea.

    However leaving it open with no solution when someone else posted one on another forum would be detrimental to the whole help effort for everyone,

    The logical solution i reached was, post solution but not the link.

    Ill be more mindful of both situations in the future.

  14. #14
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Complex Formula Algorithm (Variable size array created from index/match/adress returns

    i was going under the premise that "generally" on the internet websites dont like when you make links to other similar sites even if it would be useful
    That also makes perfect sense when you put it that way, good point

+ 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: 04-30-2014, 02:42 AM
  2. Replies: 2
    Last Post: 01-27-2014, 03:41 PM
  3. [SOLVED] Variable Row Array in Index Match Function
    By Lacaycer in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-19-2013, 11:45 AM
  4. Dynamic or Variable Lookup array in INDEX, MATCH or VLOOKUP
    By kishor_c in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-16-2012, 09:46 AM
  5. Replies: 2
    Last Post: 11-05-2011, 03:26 PM
  6. Set VBA Variable with Index/Match Array
    By erock24 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2010, 11:36 PM
  7. [SOLVED] How to use function that returns array of variable size?
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-13-2006, 04:45 PM
  8. [SOLVED] Looking for formula index/match-type that returns an array
    By Tom in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-01-2005, 05:06 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