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

XionicFire

New Member
Joined
Jan 22, 2016
Messages
49
Office Version
  1. 365
Platform
  1. Windows
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!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
ae0ea20453c2861057d920ebb1103aa3.png
21e410b43cfef175df84081bc2d44b46.png
 
Upvote 0
Someone told me to attach a miniature version of the file with the problem algorithms only, heres a very micro demo of the problem with everything else removed except for the problematic functions as well as a "mockup" of how we would want it to look in the end when the formula is working properly.

Thanks for all the help in advance
 
Upvote 0
Solved, by a gentleman from another board, but thought i might post the solution here for anyone else that might be looking for a solution to something like this, heres what the final formula came down to, and might I say its impressive, simple, elegant, minimal procesing and fast to calculate, kudos to nflsales.


On D14


=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))),"")

Formula is scrollable and draggable both ways, works like a charm!
 
Upvote 0
Solved, by a gentleman from another board, but thought i might post the solution here for anyone else that might be looking for a solution to something like this, heres what the final formula came down to, and might I say its impressive, simple, elegant, minimal procesing and fast to calculate, kudos to nflsales.


On D14


=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))),"")

Formula is scrollable and draggable both ways, works like a charm!

You can post directly to the forum a scaled-down sample along with the expected result(s). Such asample can be posted here using one of the methods listed in the following: Attachments or using this add-in:https://app.box.com/s/soezox25h3w0q5s4rcyl.

The following would be a small improvement...

=IFERROR(INDEX($G$56:$G$200,1/(1/MATCH(D$12&$C14,INDEX($D$56:$D$117&$H$56:$H$200,0),0))),"")
 
Upvote 0
Oh, thanks for the reply!,

I did include a scaled down sample, its a dropbox link about 2 posts up.

Will try your updated formula, and let you know if it passes all the tests, im also looking for one thats "autosized" or "autoscaled", the person on the other forum posted this formula, and while it does the job perfectly its kind of clunky, think it could be done any better?

<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit;">=iferror(if(len(index($g$56:index($g:$g,match("zzzzzzz",$c:$c)),match(d$12&$c14,index($d$56:index($d:$d,match("zzzzzzz",$c:$c))&$h$56:index($h:$h,match("zzzzzzz",$c:$c)),0),0)))=0,"",index($g$56:index($g:$g,match("zzzzzzz",$c:$c)),match(d$12&$c14,index($d$56:index($d:$d,match("zzzzzzz",$c:$c))&$h$56:index($h:$h,match("zzzzzzz",$c:$c)),0),0))),"")</code>
Thanks in advance!
 
Upvote 0
Oh, thanks for the reply!,

I did include a scaled down sample, its a dropbox link about 2 posts up.

http://www.mrexcel.com/forum/about-board/880179-posting-attachments.html#post4264741

Will try your updated formula, and let you know if it passes all the tests,

You did not try it at all...

im also looking for one thats "autosized" or "autoscaled", the person on the other forum posted this formula, and while it does the job perfectly its kind of clunky, think it could be done any better?

<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit;">=iferror(if(len(index($g$56:index($g:$g,match("zzzzzzz",$c:$c)),match(d$12&$c14,index($d$56:index($d:$d,match("zzzzzzz",$c:$c))&$h$56:index($h:$h,match("zzzzzzz",$c:$c)),0),0)))=0,"",index($g$56:index($g:$g,match("zzzzzzz",$c:$c)),match(d$12&$c14,index($d$56:index($d:$d,match("zzzzzzz",$c:$c))&$h$56:index($h:$h,match("zzzzzzz",$c:$c)),0),0))),"")</code>
Thanks in advance!

What kind of data do you have in the D range - text or number?
What kind of data do you have in the G range - text or number?
What kind of data do you have in the H range - text or number?

And what is the name of the sheet housing these data?
 
Upvote 0
Hi,

I did not know the fine details of cross posting, The reason i posted the "solution" and not the link to the forums so to speak from another forum was just in case anyone searched only this forum they would also find the solution, 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-...array-created-index-match-adress-returns.html
Complex Formula Algorithm (Variable size array created from index/match/adress returns)
Complex Formula Algorithm (Variable size array created from index/match/adress return
 
Upvote 0

Forum statistics

Threads
1,215,028
Messages
6,122,749
Members
449,094
Latest member
dsharae57

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top