Forum Discussion
Complicated Excel Lookup Formula
- Nov 16, 2021
mtarler I have 365. I have it almost working now. Sometimes, the formula returns information from the first cell/column ("C") and other times it returns info from the next cell/column ("D"). I just figured out when it does this: if there is not another instance of the G407 term, the formula gives me the number in cell D - it shifts to the right, instead of down. It would be much better if it can give me the result from the only time the name can be found. If you can fix this, I will be grateful. š
IGNORE my other messages.
marcwithak629 the short answer is Yes you can take into account first and last names. I think we could tweek the last to include 2 "key" inputs:
=LET(in, [blockshopperLamorindawithPurchaseDates.xlsx]Moraga!$C:$P,
key, H966,
keyB, I966,
inC, INDEX(in, , 1),
inCloc, IFERROR(SEARCH(key,inC),-1),
keyfinds, TRIM(SWITCH(inCloc,-1,FALSE,1,LEFT(inC,LEN(key)+1),MID(inC,inCloc-1,LEN(key)+2))),
pass, IFS(key=keyfinds,TRUE, (key&",")=keyfinds,TRUE,TRUE,FALSE),
inClocB, IFERROR(SEARCH(keyB,inC),-1),
keyfindsB, TRIM(SWITCH(inClocB,-1,FALSE,1,LEFT(inC,LEN(keyB)+1),MID(inC,inClocB-1,LEN(keyB)+2))),
passB, IFS(keyB=keyfindsB,TRUE, (keyB&",")=keyfindsB,TRUE,TRUE,FALSE),
fset, FILTER(in,pass*passB,0),
out,IFERROR(INDEX(fset,2,),INDEX(fset,1,)),
out
)so here I include "key" AND "keyB"
and then I repeated the same steps to see if keyB is found as unique part of the first column
and then the final set ("fset") is based on cases where BOTH key and keyB are found.
I couldn't find the file this was tested in so this mod is untested but in theory I think it should work.
mtarler I am the king of "one more thing." Sorry.
I think I failed to mention that the data in the original spreadsheet (NOT the AOBS) reflects the range of information we have for each record. Sometimes it's the student's first and last name, sometimes it's one of the parent's last names, sometimes it's one parent's first and last name, etc.
Obviously, feel free to send me whatever questions you have and feel free to unload on me if I'm asking too much.
š
Mark Bressler
- peiyezhuMar 28, 2023Bronze Contributorhttp://e.anyoupin.cn/EData/?s=original_keys_school_first_lastnames
if possible,try this online tools. only need upload data according to the sample data format. - marcwithak629Mar 28, 2023Brass ContributorHi, I REALLY appreciate your input, but I don't know sql.
- peiyezhuMar 07, 2023Bronze Contributor
Isn't there a way for you to simulate my manually hitting the enter key at the end of each formula?
simulate manually calculate may not solve the speed problem.play with sql may run faster.
create temp table aa as
select rowid old_rowid,* from original_keys_school_first_lastnames;
//select * from aa;
cli_one_dim~temp.aa~1;
create temp table bb as
select old_rowid,regreplace('\s*(&|and|\s)\s*','|',group_concat(ę°é,'|')) keywords from aaunion group by old_rowid;
select * from bb;
select regexp2(keywords,`Owner Name`),* from bb left join original_keys_school_fAOBS_Sample_database b on regexp(bb.keywords,`Owner Name`);ā
- marcwithak629Mar 07, 2023Brass ContributorHope you don't mind my mentioning something that I have already asked you about. When I copy or fill in a formula, it takes a long time to calculate because the files are so big. HOWEVER, if I manually hit enter in each cell, it usually gives me an immediate response. Isn't there a way for you to simulate my manually hitting the enter key at the end of each formula? That's what I do: I go to the cell, move the cursor to the end of the formula, and then hit enter.
- marcwithak629Mar 07, 2023Brass ContributorI'm still working on this and it would be amazing if we can speak by phone. I think I can explain everything a lot better than I have via message. If you don't want to do that, I will fill in the gaps here. Let me know. I'm in California near San Francisco (if I haven't already told you that).
- marcwithak629Mar 06, 2023Brass Contributor
mtarler I am sorry for being a challenge to deal with. Lots of family issues, including my wife who has been sick for 3 years. 1) AOBS is NOT our database: it's a database of homeowners we have scraped from the Blockshopper.com website. My goal is to match names from Blockshopper to names I am able to obtain from various sources. Sometimes, I get names of husbands and wives; other times, I get student names. When I get a student's name, only his or her last name matters because the student's name is rarely listed on Blockshopper. If the student has an unusual last name, we can often find the right match. But if the student's last name is "Smith," all bets are off. When we get the parents' names, we have a better chance of finding the right match on Blockshopper, because some version of both names is usually listed on the property title. Sometimes, I try to find matches based on last names; other times based on both names.
I only understand parts of your formulas, but enough for me to get decent results. Your formulas with multiple names are amazing: they don't get as many results, but the results are unbelievably accurate because you're matching a few names. I will play with what you just sent me and see how it does. I'll be back in touch soon (hopefully) with an update.
Mark B.
- mtarlerNov 23, 2022Silver Contributor
marcwithak629 so you say "... I am trying to add more names to our database" but then you say "Whenever there's a match, I'm bringing that data to the #1 Formulas worksheet". That seems backwards to me since isn't AOBS the database that you are trying to fill in? Regardless, in the attached I added a tab called Lookup Tool, as an example of what I was talking about. I added a column on the #1 formulas worksheet called skip# just so you insert a number or letter or anything to skip it for later or maybe mark it as 'done' after going through all the 'blanks' you can then go back and review the 'skips'. Note in this example I include any line from the AOBS that finds at least 1 of the last names from the #1 sheet. This lookup could get more fancy and create "scoring" based on how many and which items match and then sort the results based on that scoring. This technique will also be MUCH faster and efficient as excel only has to look up 1 item at a time since you will only be looking at 1 at a time that should be fine.
Note I also formatted both tables as tables which makes things more efficient and easier to sort or filter but technically not required for this concept to work. And formatted as table the look-up in that table creates a !spill as that is not allowed inside tables but my proposal is to not use that lookup in the table.
- marcwithak629Nov 21, 2022Brass ContributorAlso, it really sucks that there isn't a way to trigger clicking on the enter key. When I'm going through the data, that seems to be the one surefire way to trigger the formula and get an output. For example, I may have clicked on manual calculation multiple times with nothing changing. But, if I go to the cell, position the cursor at the end of the formula, and then click enter, it immediately gives me the calculation result.
- marcwithak629Nov 21, 2022Brass ContributorI'm not sure where to begin because I'm lost. Let me do a better job explaining what data I have available and what I'm trying to accomplish: 1) The complete AOBS worksheet has almost 30,000 addresses with the information that you can see in the sample columns on the AOBS file (owner's names, date purchased, city, etc.); 2) The "#1 Formulas Worksheet" is where I am trying to add more names to our database. On this worksheet, I have a variety of information that I am trying to match to the homeowner's information in the AOBS file. For example, I may have the first and last name of a husband and wife in the formulas worksheet and I want to find homeowner's info in the aobs file that includes some or all of their names. Obviously, the more names that match, the more likely that it's a genuine match. In other cases, I have a student's first and last name and I am trying to match his or her last name with a name or names that show up under homeowner's info. Whenever there's a match, I'm bringing that data to the #1 Formulas worksheet. Ideally, I would prioritize data from a row that also has a city match. This is my goal and I'm open to any way to make it happen. Thoughts?
- mtarlerNov 21, 2022Silver Contributor
marcwithak629 so answer to #1 is no but if we make the formula more efficient it will help. so on that point, here is a variation might be better:
=LET(in, 'AOBS Sample'!$B$5:$G$40, key, IF(TRIM(G2)="",NA(), G2), inC, " "&SUBSTITUTE(INDEX(in, , 1),","," ")&" ", pass, ISNUMBER(SEARCH(" "&key&" ",inC)), fset, FILTER(in,pass,0), out,IFERROR(INDEX(fset,2,),INDEX(fset,1,)), out )as for the rest I have some questions and such. and the file you attached has formulas that point to other data sources and the data source tab (AOBS Sample) doesn't have any matches for the sample search data.
as for being able to search for multiple names in the same formula we could definitely add some if conditions inside the filter or as part of the pass but i need to know more to know how. For example the last name must always match, the state if present must match, then what to do about first name? Like if it matches any results then only return those? basically the if present then must match is much easier to deal with than if present and if matches then ...
on yet another note, it sounds like you are trying create a sublist to help you decide which actual data line is correct reference. Can i suggest maybe a different format. For example I can image having tab A the new incoming data and tab B the directory data set and then in tab C you could have it automatically show the first line from tab A that is missing x/y/z info (or x/y/z is set to a certain value, but I'll mention that more below). Then under that line would be all the potential matches from tab B. Once you determine which is the right match you copy and paste that info onto tab A which then means that line is no longer blank so it shows the next line with missing info. basically tab C is then a tool to go through and update tab A. Now let's say you get a line you just aren't sure about and want to skip, may you enter xxxx into the field we are checking so it will 'skip' that row but later you can change that setting I mentioned above from 'blank' to 'xxxx' to go back and re-review the questionable ones.
and one step further, I would recommend adding an unique index value to the directory tab and then adding the corresponding index value onto tab A instead of copying all the information over. Having the unique id will make any future referencing easy and you don't bloat your workbook unnecessarily.