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!
 
http://www.mrexcel.com/forum/about-board/880179-posting-attachments.html#post4264741



You did not try it at all...



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?

Hi Aladin, I am just about to sit down and test the different answers i had not had time to do it that day over the weekend, I will make sure to let you know if it does the job correctly

As for the kinds of data on the ranged they are mixed, they are text, number or text and number, on the demo sheet you can do an essential test run of how it should work, a summary "demo" of this data is in that sheet, for simplicity we put everything on a single sheet as we found it makes porting and troubleshooting easier, but once we find a solution that works we "port" it into the official workbook that uses multisheets, and test it again.

If you want a more thorough copy of the original document let me know, i can remove a large chunk of the Database (its now around 28mb) to make it smaller and post it here, multisheet and all.

Thanks for taking the time to respond
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
The posting of the solution from another forum is fine, no problem with that at all.
It is knowing about the cross-posts up-front before deciding whether to invest time in trying to answer. I'm not sure if you followed the hyperlink given right at the end of rule #13. If not then you should, and have a good read of that linked page.
Anyway, you are aware of what is required in the future. :)
 
Upvote 0
http://www.mrexcel.com/forum/about-board/880179-posting-attachments.html#post4264741



You did not try it at all...



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?

Hi Aladin,

I just tried your formula, im sorry i had not tested it earlier, had little time over the weekend, i just finished testing it and got interesting results that were completely unexpected,

It does work multipage, I found it leaves some zeroes in certain spaces and blanks in others, originally i thought it was an unexpected inconvenience but later i found its actually very usefull, but were still divided over the issue, whenever the formula finds a match even if the info in that match is blank, it displays a 0, but if it does not find a match for the variable it leaves it blank.

Were still debating what is best since its definitely usefull to find out which routers had which info, and which had not.

Also your formula appears even far more efficient (as far as processor computing time on a large sheet) than the last one.

Is there a way to make it work both ways? (the way it works now, and another where 0 = blank regardless?)

and also, as asked before, a way to make it autosizing? we know the data starts from D13 onward but the final data point is unknown, something like $D$13:$D$? currently we set it at $D$100000 and it works but we dont know if it can be made efficient and autosized.

As far as your questions about the ranges, all 3 (D,G,H) have all 3 types text, number, and text and number.

And as for the sheet, we found for testing its better to keep the test forumulas always on a single page as it eases troubleshooting, and once we finish initial testing we "port" it over to the official workbook with multiple sheets.

If you wish we can post here a short version of the actual official workbook with the database considerably reduced (currently the database is 28mb, too big to share), so you can see on the final document itself what we are trying to do.

Again sorry for the late response, let me know if you need any other info.
 
Upvote 0
Whoops, sorry for the double post, i thought id lost the first message and typed it again a few minutes later. i couldnt find a delete button.
 
Upvote 0
The posting of the solution from another forum is fine, no problem with that at all.
It is knowing about the cross-posts up-front before deciding whether to invest time in trying to answer. I'm not sure if you followed the hyperlink given right at the end of rule #13. If not then you should, and have a good read of that linked page.
Anyway, you are aware of what is required in the future. :)

The help weve gotten from the community has been overwhelmingly impressive, i apreciate all the time you guys take to help people out and will definitely be more mindful of those points in the future.
 
Upvote 0
http://www.mrexcel.com/forum/about-board/880179-posting-attachments.html#post4264741



You did not try it at all...



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?

Hi Aladin

Weve been trying to figure out pros/cons of the formula but were not sure what a part of it does:

What does the 1/(1/MATCH part of it do?

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

Whats its function vs the say vs this one?

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

"As far as your questions about the ranges, all 3 (D,G,H) have all 3 types text, number, and text and number."

Is it not possible to give a straight answer? Are you saying that D houses text and number, G houses text and number, and H houses also text and number?
 
Upvote 0
You write:

"As far as your questions about the ranges, all 3 (D,G,H) have all 3 types text, number, and text and number."

Is it not possible to give a straight answer? Are you saying that D houses text and number, G houses text and number, and H houses also text and number?

Sort of, what i was saying is D,G and H houses sometimes text, sometimes number and sometimes text AND number

For example, sometimes it reads 82404, sometimes 82404S and sometimes DDSR31TT21, meaning it contains all 3 kinds of data that you asked
 
Upvote 0
Sort of, what i was saying is D,G and H houses sometimes text, sometimes number and sometimes text AND number

For example, sometimes it reads 82404, sometimes 82404S and sometimes DDSR31TT21, meaning it contains all 3 kinds of data that you asked

My goodness. Why is this that hard? Is D both?

If D just would consist of:

210
DAX

the answer is: D consists of text and real number (that is, 210 is a real number, not a text number).

If D just would consist of:

502
blank
700
900

the answer is: D consists of real numbers.

If D just would consist of:

DDSR31TT21
JAD
blank
NAD
'200

the answer is: D consists of just text (Note. '200 is a text number, not real number.).
 
Upvote 0
Oh im sorry i did not understand what you meant, i thought you meant something entirely different, if i understand you correctly:

In your terms D would be:

210
DAX
DDSR31TT21

Text & real numbers

G would be:

DDSR31TT21
JAD
blank
NAD
210
'200

Text, Real Numbers & Text Numbers

H would be:

DDSR31TT21
JAD
blank
NAD
210
'200

Text, Real Numbers & Text Numbers

Is that the info you required?

(sorry again for the noobishness, stil llearning the forum terms)






 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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