I like working with variables in Excel, it is useful converting everything between commas into a variable, but I got stuck in here, does anyone have an idea how to use array limitations with INDEX() function such as seen in the example?
This is an array formula in a table form:
{=INDEX([#Column1]=[Column1],MATCH(1,([Column2]="Ready"),0),0)}
it returns the right value for the first instance of [#Column1]=[Column1] but for the rest, the result is wrong.
A sample can be found in >>>here<<<.
I saved this in another language, please let me know if transcription of functions are incorrect when you open. I tested but..you know..
This does not need to be an array, use COUNTIF/S instead:
=COUNTIF([Column1],[#Column1])=COUNTIFS([Column1],[#Column1],[Column2],"Ready")
Related
So I quite often find myself doing tasks on Excel which involve evaluating a text string as an array. Generally speaking I just use this:
Function EVAL(Ref As String)
EVAL = Evaluate(Ref)
End Function
So the formula will be, for example:
=EVAL("{"&CHAR(34)&SUBSTITUTE(TEXTJOIN(";",TRUE,MID(Index[Industries],2,LEN(Index[Industries])-2)),";",CHAR(34)&";"&CHAR(34))&CHAR(34)&"}")
The cells in this example will have contents like:
;Automotive;Rail;Energy;
;Automotive;Rail;
;Energy;
;Automotive;Aerospace;
(As it happens this is the precise problem I'm stuck on right now, though it has come up in different ways in the past.)
This has worked for me in the past, but I've been running into difficulties lately.
I have come to the conclusion it isn't working because application.evaluate, it turns out, has a character limit of 255. I've seen examples of VBA tricks to bypass this for text strings that are formulas rather than arrays, but copy-pasting those they don't seem to work for when I'm using it to interpret a text string as an array rather than as a formula.
Is there some trick to get this to work? (Or, indeed, is there some alternative method to achieve this altogether?)
Right, as per my comments, if you are using ms365, you could avoid your workbook to be xlsm just because you need to split values into an array. Make use of what is available with native functions, for example:
Formula in C2:
=TEXTSPLIT(CONCAT(A1:A4),,";",1)
Formula in D2:
=FILTERXML("<t><s>"&SUBSTITUTE(CONCAT(A1:A4),";","</s><s>")&"</s></t>","//s[node()]")
Note 1: As per time of writing you'd need to enable the BETA-channel to gain access to TEXTSPLIT(), and if I recall correctly your version (2203) is allowed to start using this function. Just google how to get access and update your Excel.
Both options can obviously be nested inside the UNIQUE() function.
Note 2: If at any point CONCAT()'s limits are reached (32767 characters, thanks #ScottCraner), maybe you can avoid using that with help of the lambda's helper function REDUCE():
=TEXTSPLIT(REDUCE("",A1:A4,LAMBDA(a,b,a&b)),,";",1)
Note 3: In case you can't update your Excel just yet, and you wonder how to use FILTERXML(), don't mind me refering you to another post I wrote a while back here.
Sorry i know this is super basic but i didn't know where else to ask and i really feel like the answer is right in front of me...
I have a spreadsheet which im going to use to log PAT test results. When i select the test type from a drop down it changes the standards and thresholds in the bit below and will tell me if each test passes or fails. It uses several vlookups and relative references - so far no VBA. Looking at this photo. What I'm trying to do is get the formula in cell I13 to read the symbol in F13 and use that in the formula rather than typing the symbol directly into the formula as its going to change when i change the Class Type option.
So far ive gotten to this (has a blank IF to start with to keep it neat:
=IF(H13="","",IF((H13&F13&(VALUE(G13))),"PASS","FAIL"))
The bit in bold is where the issue is. When i run the evaluate formula it boils the bold bit down to "0.01>2" which is correct however it then wont read that in the larger IF statement - i think its the quotation marks. So i think it needs another function to allow the IF statement to read that as the logical test rather than a text string.
I've tried VALUE, FORMULATEXT, NUMBERTEXT, all the ones that might be close to what I'm trying to do but 100% stumped now. Always bring sup the #VALUE Error.
Appreciate any advice? TIA
There is no built-in function for that. You need either a VBA function or the old EVALUATE XLM function (which you can't use directly in a cell, it has to be in a defined name). Sample UDF:
Function EvaluateFormulaString(FormulaString as string)
EvaluateFormulaString = application.evaluate(formulastring)
End Function
then your formula would become:
=IF(H13="","",IF(EvaluateFormulaString(H13&F13&(VALUE(G13))),"PASS","FAIL"))
I'm trying to do a search for multiple strings in a cell with an OR-condition in Excel 2016.
E.g. I have a string abcd1234 and I want to find ab OR 12.
I'm using the german version where the function SEARCH is called SUCHEN and it should behave the same way.
I found this answer which suggests this solution:
SEARCH({"Gingrich","Obama","Romney"},C1).
I also found this website which suggests the same syntax:
SEARCH({"red","blue","green"},B5)
Same with this website:
SEARCH({"mt","msa","county","unemployment","|nsa|"},[#Tags])
So they basically say make a list of search terms separated by commas enclosed by curly braces and you're good.
But putting these into Excel 2016 just results in the usual meaningless Excel error message which says there was an error with the formula and it's always highlighting the whole part in curly braces.
Taking the first example the only way I could get Excel to not throw its error message was to change the syntax like this:
=SEARCH({"Gingrich";"Obama";"Romney"};C1)
But separating the search terms with semicolons doesn't apply the OR-condition correctly, so this is not the solution.
I'm aware from this answer that I could make separate searches and string them together with a condition, but I would like to avoid that, and I also want to know why the syntax that is supposed to work as confirmed by multiple sources is not working for me.
EDIT:
Okay, I'm starting to understand this, thanks to Solar Mike:
The code =IF(COUNT(SEARCH({"Romney","Obama","Gingrich"},A1)),1,"") works indeed perfectly fine.
Also =COUNT(SEARCH({"Romney","Obama","Gingrich"},A1)) works.
But =SEARCH({"Romney","Obama","Gingrich"},A1) does not.
Also =ISNUMBER(SEARCH({"Gingrich","Obama","Romney"},A1)) does not work.
I'd love to know the reason why.
Ok, so this works:
OR(IFERROR(FIND("ab",A1,1),0),IFERROR(FIND("12",A1,1),0))
tested here :
I followed one of the links and the version like this:
=IF(COUNT(SEARCH({"Romney","Obama","Gingrich"},C1)),1,"")
worked as expected for me, but if the search is isolated it then fails and I have not found an explanation ...
Like other array-style formulas, the part that delivers the array has to be enclosed in some sort of aggregate function to make it scan through the array - otherwise it only looks at the first element of the array. So anything like COUNT, SUM, SUMPRODUCT will do the trick.
My preferred one is
=OR(ISNUMBER(SEARCH({"a","b","c"},A1)))
because you can easily change it to this if you want AND logic:
=AND(ISNUMBER(SEARCH({"a","b","c"},A1)))
I have a problem on a VLOOKUP function in an Excel.
Basically i am trying to search a route from another spreadsheet, using a reference number.
- example: I put in a reference (lets say WPC 80) and i want to get a route (for this ex it should be Pitesti - Wrzesnia:
The problem is that it gives me something random.
I know that maybe im not using it correctly, but do you have any idea?
Thank you!
As noted in VLOOKUP documentation, the last parameter contols whether to use Exact Match or Approximate Match.
Try using exact matching:
=VLOOKUP(..., FALSE)
Sorry not enough rep to post a comment. When using vlookup, and the Range_Lookup parameter is TRUE, the lookup table must be sorted in ascending order, or you will get unusual results. Also ensure you put an absolute reference on the lookup table for when you drag it down.
Better use INDEX and MATCH combination, faster and far more reliable.
For some reason the MATCH function on excel returns an error.
Unfortunately I cannot share the data in order to replicate the problem but I was wondering if someone more experienced than I am could possibly find a small error in my code or something that I missed.
I used the functions according to these directions and I also I tried a solution here but neither source helped much.
=INDEX(IB_RAW!A2:L301,MATCH(1,(IB_RAW!$B:$B=IB!P10)*(IB_RAW!$D:$D=IB!A9)*(IB_RAW!$C:$C=IB!Q9)*(IB_RAW!$L:$L=IB!P7),0),IB_RAW!$J:$J)
I will try to describe the data as best as I can:
IB: The sheet where I want to show the extracted value
IB_RAW: The sheet where I get the information from
A2:L301: The whole dataset that I am using to look for the arguments
(in IB_RAW)
J: The value I want to extract (in IB_RAW)
The issue is with the MATCH function, as it returns #N/A, I've used the Show Calculation Steps... option to see where the problem is,
So for
(IB_RAW!$B:$B=IB!P10) returns TRUE
(IB_RAW!$D:$D=IB!A9) returns FALSE
(IB_RAW!$C:$C=IB!Q9) returns TRUE
(IB_RAW!$L:$L=IB!P7) returns TRUE
Therefore MATCH(1,0,0) but this returns #N/A instead.
Ok, The solution was from this detailed guide. It actually explains that you have to press Ctrl+Shift+Enter to activate the function and also I had to change the line of code a bit.
Hopefully this will be helpful to someone who wants to do the same thing like I did.
=INDEX(IB_RAW!I2:I301,MATCH(1,(IB_RAW!B2:B301=IB!P10)*(IB_RAW!D2:D301=IB!A9)*(IB_RAW!C2:C301=IB!Q9)*(IB_RAW!L2:L301=IB!P7),0))