Why Excel can't find the lookup reference but still returns a valid result? - excel

In an Excel file I saw lookups on several cells that look like this:
#SomeString
#AnotherString
Both return some values. I didn't know or use # command before but now learn that it's a kind of lookup. Now if I find SomeString by looking in the value across the whole workbook, I can locate the lookup. However I can't find AnotherString that way.
Is there any way I can find the lookup location? Additionally, is it possible that if the lookup is in fact deleted from the workbook, the value returned from a previous reference is still valid, as it may be the case here?
UPDATE: It turns out they refer to several defined names.

Related

Returning a column reference from MATCH to avoid using INDIRECT with a Named Range

TL;DR: I'm basically trying to obtain a column range such as 'Sheet 1'!$A:$A where the A is obtained by matching the contents of a given cell to a 1:1 range within a sheet referenced by another given cell, for use in a dynamic range.
In the highly probable case where that made zero sense, here's an illustration:
PARAMETERS: A2 = "LIST" | C2 = "FirstName" | Desired result: 'LIST'!$A:$A
And I've obtained that, BUT, I can't use that output ('LIST'!$A:$A) within formulas (namely to create a dynamic range). For instance, here 'LIST'!$A:$A contains 101 cells with values in them:
V3 = NamedFormula = 'LIST'!$A:$A
COUNTA(INDIRECT(V3)) = 101
COUNTA(INDIRECT(NamedFormula)) = 1 because it evaluates to #VALUE and that is a singular result.
Before delving into the topic of using INDIRECT with a Named Range (which I've read about and am still getting over my confused grief), I'm realizing my Names are getting a bit out of hand. I tend to use Excel like a mad scientist. So, in case there's a much simpler solution to what I'm trying to do, here's my actual mission:
0. I'm building a tool to simplify a process where email addresses are built from different data, which needs to run without any scripts, only formulas.
1. A tab with no imposed name would contain a user database with minimally (firstname and lastname OR IDs) AND (potentially other data columns) in no specific order. Tool users would import that tab from wherever the data got to them depending on the client, and would only need to copy-paste relevant headers to the main tab without changing anything else here for data integrity.
2. The main tab would have specific input fields where tool users would paste in the name of the imported tab as well as the labels of the columns they need (for instance, the labels in the first row of the columns containing the first name and the last name), and an input field for the domain name to use to build those email addresses.
3. A Data tab is referenced for cleaning and preparing strings for email address formats.
4. The Export tab would spew out a list of clean email addresses that can be exported to CSV.
The Data tab is just 2 columns to use with SUBSTITUTE so that for instance apostrophes are removed but accented letters are normalized (é -> e). I've used LAMBDA within Names to get there. The problem is to tie everything in - to get those Named ranges into the final formula.
The Names I'm using so far (I'd like to use fewer but testing specific parts extended beyond simple usage I fear):
ALPH ={"A";"B";"C";"D";"E";"F";"G";"H";"I";"J";"K";"L";"M";"N";"O";"P";"Q";"R";"S";"T";"U";"V";"W";"X";"Y";"Z"}
LABELS =LAMBDA(labelname,ADDRESS(2,MATCH(labelname,INDIRECT("'"&PARAMETERS!$A$2&"'!$1:$1"),0),1,1,PARAMETERS!$A$2))
RANGECOL =LAMBDA(labelname,COLUMN(INDIRECT(LABELS(labelname))))
RNCOL =LAMBDA(label,"'"&PARAMETERS!$A$2&"'!$"&INDEX(ALPH,RANGECOL(label))&":$"&INDEX(ALPH,RANGECOL(label)))
I haven't tied everything in the Data tab yet - I'm still trying to automate my main tab before pushing further and using the Data tab substitutions on top of everything. That will be the next step, not my current focus. But, for the curious and interested, on the Data tab I'm using something something I found on ablebits which works wonders =]
So, now if I use the offset range with a static LIST!A:A it works:
=IF($C$2<>"",LOWER(INDEX(OFFSET(INDIRECT(ADDRESS(2,MATCH($C$2,INDIRECT("'"&$A$2&"'!$1:$1"),0),1,1,$A$2)),0,0,COUNTA(LIST!A:A)-1,1),ROW())),"") &IF($C$3<>"","."&LOWER(INDEX(OFFSET(INDIRECT(ADDRESS(2,MATCH($C$3,INDIRECT("'"&$A$2&"'!$1:$1"),0),1,1,$A$2)),0,0,COUNTA(LIST!A:A)-1,1),ROW())),"") &"#"&$C$4
But when I try to use the dynamic RNCOL($C$3) it does not:
=IF($C$2<>"",LOWER(INDEX(OFFSET(INDIRECT(LABELS($C$2)),0,0,COUNTA(INDIRECT(RNCOL($C$2)))-1,1),ROW())),"") &IF($C$3<>"","."&LOWER(INDEX(OFFSET(INDIRECT(LABELS($C$3)),0,0,COUNTA(INDIRECT(RNCOL($C$3)))-1,1),ROW())),"") &"#"&$C$4
This just gives #REF, and evaluating shows the digression starting at INDIRECT(RNCOL($C$3)) equating to #VALUE.
I'm starting to see double here but my undying and completely normal love for Excel prevents me from going home from work as I'm way too far down the rabbit hole to let my obsession die here.
Any pointers as to how this can work?
Note - all of the names in the supplied sheet were generated by an online fake name generator, nothing in here is actual user data #GDPR
Thanks in advance! <3
Test sheet is available via Google Drive.
Your current set-up is not good for many reasons, and in my opinion would require a complete overhaul, the scope of which lies beyond a response on this website.
As to a 'quick fix' to your current issue, the reason your formula in E1 is currently returning an error is due to the fact that, as you can see via stepping through with the Evaluate Formula tool, the part
COUNTA(INDIRECT(RNCOL($C$2)))-1
is resolving to
COUNTA(INDIRECT({"'LIST'!$A:$A"}))-1
and this is not the same as
COUNTA(INDIRECT("'LIST'!$A:$A"))-1
in that the value being passed to INDIRECT is an array in the former though not in the latter. Although INDIRECT can accept arrays, it is only within certain constructions in conjunction with other suitable functions; here it will simply error.
And the reason that it is returning an array is due to the fact that RNCOL($C$2) is returning an array, and that is because that function is defined as
=LAMBDA(label,"'"&PARAMETERS!$A$2&"'!$"&INDEX(ALPH,RANGECOL(label))&":$"&INDEX(ALPH,RANGECOL(label)))
and, since RANGECOL($C$2) resolves to 1 here, the above is equivalent to
"'PARAMETERS!$A$2'!$"&INDEX(ALPH,1)&":$"&INDEX(ALPH,1)
Here, because you are omitting the column_num parameter from INDEX, the part
INDEX(ALPH,1)
is resolving to
{"A"}
which is an array (albeit one comprising a single value) and technically different from
"A"
In most circumstances, this is not an issue. As such, it is almost always unnecessary to pass both a row_num and column_num parameter to INDEX when indexing a one-dimensional array. Here, however, it matters.
You can resolve this by explicitly including a column_num parameter, i.e. redefine RNCOL as
=LAMBDA(label,"'"&PARAMETERS!$A$2&"'!$"&INDEX(ALPH,RANGECOL(label),1)&":$"&INDEX(ALPH,RANGECOL(label),1))

Power Query - Check if source value is in another list/table

I'm experimenting with PowerQuery and I got to a good point, but I'm stuck with something. I checked here and other places, but couldn't find anything that helped me solve the issue.
I have a Source in PQ I can use and transform. Once this Source (a .csv) is loaded in PQ editor, I would need to verify if a specific column value is in another table/list or not.
So I created a small table in another sheet and created another Source for it.
I am trying to create a new column and validate now with "each if" if the current main Source value in that column (that obviously varies, they are names) is part of the list/table that is the other Source. And in case it is, the added column value will be YES, otherwise NO.
A simple check that in Excel I would have done probably with vlookup.
I always referred here as list/table as i tried to have it created as List or table, without success.
Is anybody here able to help?
= Table.AddColumn(#"Promoted Headers", "Real_A", each if Table.ContainsAny(Source, EMEAL, {[Analyst]=[EMEA]}) then "EMEA" else "XX")
This is what I tried last. The "Source" is the .CSV I read already and [Analyst] is one column of it.
[EMEA] is the name of the column in EMEAL (list).
The error I have:
Expression.Error: We cannot convert the value "Pippo" to type Record.
Details:
Value=Pippo
Type=Type
"Pippo" is the value in [Analyst] column, but as well one of the value in the EMEAL list... so, also here quite confused where the issue really is.
thanks!
The equivalent to this kind of VLOOKUP is a Merge-opertion like described here: http://www.myonlinetraininghub.com/excel-power-query-vlookup

Single Use List - Excel

I'm after a way of preferably using VLookup to return information and once returned, have the source information unavailable for the same lookup.
e.g. If I have a list of names I have not used in seating for an event, I will want a formula which can look up this information WITHOUT entering the same name more than once. I'd rather not do a drop-down option as requires selecting the entry and I want my whole table to be an self-filling database.
I've about 20 nested IF functions going on in one cell so ideally something that could fit in there easily? Ill take anything honestly :P
Thanks in advance

Named Range "name" vs name

I have a ridiculous problem in Excel 2003 where I want to reference a Range I have defined myself, with names such as Div1, Div2, Div3 etc.
I have a macro that determines whether I need to use Div1, Div2, Div3 etc. and I then need to use VLOOKUP and MATCH with these different ranges.
However:
MATCH("ValueSearched", Div1, 0) works fine, but
MATCH("ValueSearched", "Div1", 0) fails
Since Div1 is determined programmatically, it is only stored as a string and I cannot use it.
I understand that in normal programming, you never really reference values like this and would use a hash table or similar, but I thought Excel would have a better work around as everything is done runtime.
Any suggestions on how I can dynamically reference these ranges?
pnuts solved it.
Have you tried =MATCH("ValueSearched",INDIRECT(Div1),0)

Excel, using a second index match if first is empty

I was wondering if theres an easy way to setup a formula that is an index match one a sheet of data, and then if there was no match, look somewhere else.
I have new results which I want to look up from, then if not I have historical results to look up from. I dont want to combine the data as I dont want the historical numbers to change any averages in the new results.
I could use two columns each with a different index match and then some IF, OR statements but I'd like to know if theres a way of doing it all in one forumla.
Thanks
MATCH will return an error where a matching value is not found. This can be used to switch to an alternative match attempt, eg:
=IFERROR(INDEX(Sheet1!A:A,MATCH(C1,Sheet1!B:B,0)),INDEX(Sheet2!A:A,MATCH(C1,Sheet2!B:B,0)))

Resources