Why the INDIRECT excel method doesn't work as expected - excel

These two methods bring to a different result. Why?
=OR(NOT(ISERROR(SEARCH('[FILTER_OBJECT_SETTING.xlsx]Filter Object'!$A$1:$A$5);A1))))
Correct value!! I get TRUE! It works!
=OR(NOT(ISERROR(SEARCH('[FILTER_OBJECT_SETTING.xlsx]Filter Object'!$A$1:INDIRECT("$A$5");A1))))
Uncorrect value!! I get FALSE! It doesn't work as expected!!
In A1 there is the following value:
0,"Annotations","10:00:00:00","10:00:08:23","Testo"
Instead, in "FILTER_OBJECT_SETTING.xlsx" there are the following values from A1 to A5:
"Abbigliamento"
"Vestito"
"Porta"
"Testo"
"Statua"

Use INDEX/MATCH to return the last cell:
=OR(ISNUMBER(SEARCH('[FILTER_OBJECT_SETTING.xlsx]Filter Object'!$A$1:INDEX('[FILTER_OBJECT_SETTING.xlsx]Filter Object'!$A:$A;MATCH("zzz";'[FILTER_OBJECT_SETTING.xlsx]Filter Object'!$A:$A));A1)))

Related

Excel formula to allow me to retrieve the codes of the most valuables drinks

Good night,
I'm trying to think of a simple excel formula to allow me to get the codes of the most valuables drinks.
I don't wanna use PivotTable for this one.
Ex:
I want to retrieve, for MALIBU, the code 8991
For JAMESON, the code 6113 etc
I'm stuck here since I woke up haha
Thanks!
Try below formula for dynamic spill result-
=LET(x,UNIQUE(C2:C12),y,BYROW(x,LAMBDA(r,INDEX(SORT(FILTER(A2:B12,C2:C12=r),2,-1),1,1))),HSTACK(x,y))
Using MAX function to consider the scenario where more than one code for a given drink can have the maximum value. In cell E2 use the following formula:
=LET(rng, A2:C13, codes, INDEX(rng,,1), values, INDEX(rng,,2),
drinks, INDEX(rng,,3), drinksUx, UNIQUE(drinks),
maxValues, BYROW(drinksUx, LAMBDA(ux,
TEXTJOIN(",",,FILTER(codes, (drinks = ux)
* (values = MAX(FILTER(values, drinks=ux))))))),
HSTACK(drinksUx, maxValues)
)
Here is the output:
Note: Another code for HEINEKEN was added for testing purpose of more than one code with maximum value.
XMATCH can be used for the same purpose too, but it is a more verbose formula:
=LET(rng, A2:C13, codes, INDEX(rng,,1), values, INDEX(rng,,2),
drinks, INDEX(rng,,3),drinksUx, UNIQUE(drinks),
maxValues, BYROW(drinksUx, LAMBDA(ux, TEXTJOIN(",",,
LET(maxValue, MAX(FILTER(values, drinks = ux)),
FILTER(codes, ISNUMBER(XMATCH(drinks & values, ux & maxValue))))))),
HSTACK(drinksUx, maxValues)
)

Excel french issue

I have Excel sheet with value and another column value that depend of theme
If value >48 the value will be 8 if <=40 value will be 0 if value inferior a 48 and supperieru a 40 value will be column -40 I tried this but didn't work
=SI(AH15>48,8,SI(ET(AH15>40,AH15<48,AH15-40))
Or english:
=IF(AH15>48,8,IF(AND(AH15>40,AH15<48,AH15-40))
You are throwing in an AND function to check multiple conditions in a wrong manner:
All these conditions ET(AH15>40,AH15<48,AH15-40) can never be true since the last parameter is a calculation. Either way, what you tried to do is maybe:
=SI(AH15<=40,0,SI(AH15>48,8,AH15-40))
Which translates to:
=IF(AH15<=40,0,IF(AH15>48,8,AH15-40))
Try this one:
=IF(AH15>48,8,IF(AND(AH15>40,AH15<=48),AH15-40,0))
Hope it helps

Problems Using LOOKUP() in Excel

I want to use the LOOKUP function to match values according to their category (see picture).
It worked so far as expected, but when I enlarge the range of the lookup_vector, it breaks, meaning that once I get the expected value, once #N/A.
In one row I have =LOOKUP(T2,'Electrode Clalc'!P3:P36,'Electrode Clalc'!E3:E36) , in the other I have =LOOKUP(T3,'Electrode Clalc'!P3:P37,'Electrode Clalc'!E3:E37).
Case 1 where it works:
Case 2 where it doesn't:
P36/E36 and P37/E36 contain both similar code:
P36: =0.8*(D36-N33)*(1-LOOKUP(A32,'LFP Calculations'!A2:A32,'LFP Calculations'!E2:E32))
E36: =CONCATENATE(LEFT(A32, 100),"-",LEFT(B32, 100),"-",LEFT(C36,100))
and
P37:=0.8*(D37-N33)*(1-LOOKUP(A32,'LFP Calculations'!A2:A32,'LFP Calculations'!E2:E32))
E37:=CONCATENATE(LEFT(A32, 100),"-",LEFT(B32, 100),"-",LEFT(C37,100))
I would appreciate if someone could help me.
Thank you in advance.
EDIT:
In the formula where it does not work:
=LOOKUP(T3,'Electrode Clalc'!P3:P37,'Electrode Clalc'!E3:E37)
It is because:
the value in T3 cannot be found in P3:P37 (check for spaces before or after);
or if it is found, on the same row of the found value in column E there is an error, thus it returns the error correctly;

Excel Nested IF AND

I have the following formula:
=IF(AND(A1=0,A3="","1 item"),
IF(AND(A1=0,A3="Exclude","1 item"),
IF(AND(A1=1,A3="Exclude","1 item","2 items"))))
3 combinations of cell values in A1 and A3 return text which I'm calling "1 item"
Only 1 combination of cells value returns text which I'm calling "2 items".
The only combination to return "2 items" is where A1=1 AND A3="".
The formatting is wrong but I'm not sure where.
Any help would be greatly appreciated.
this is the correct formula -
brackets of AND() were not properly closed.
=IF(AND(A1=0,A3=""),"1 item",IF(AND(A1=0,A3="Exclude"),"1 item",IF(AND(A1=1,A3="Exclude"),"1 item","2 items")))
Excel's IF expects three parameters: Condition, What to do if condition is TRUE, and what to do if condition is FALSE.
I'll re-format your formula so you can see where the error is:
IF( AND(A1=0,A3="","1 item") ,
IF(AND(A1=0,A3="Exclude","1 item"),
IF(AND(A1=1,A3="Exclude","1 item","2 items")
)
)
)
As you can see
For the first IF you are not providing what to do if condition is FALSE,
The same for the second IF,
The third IF has no definition of what to do if the condition is TRUE or FALSE.
Hope this helps you.
UPDATE
Following your comment (which is still not clear to me), hereinafter I'm providing simple rules you may use to construct your formula correctly:
Write your formula as a piece of text (like the example I show above) so that you can easily read, edit and verify it,
Remember that Excel's IF has three parameters: Condition, result when condition is TRUE and result when condition is FALSE,
Within any of these three parameters, you can include whatever you want PROVIDED that the result is compliant with what the function expects for that parameter; for instance, writing for the first parameter 3=8 is completely legal since the result is FALSE (while 4=2*2 would yield TRUE).
Having this in mind, here is the formula I think you are looking for (WARNING!!! I'm not sure I understood what you need, but if not, changing it should be very easy for you now):
IF(AND(A1=1,A3=""),"2 items","1 item")
This is based on your wording: The only combination to return "2 items" is where A1=1 AND A3="".

excel nested vlookup function using formats and NA Arguments

I placed an example below, of which I don't necessarily 'need' to work, but I don't like that I can't get it to work. I've attempted to use the ISNA function, but am having little success since I
=IF(VLOOKUP(H3,Credit!H:J,3,FALSE)=(J3*-1),"Please Purge",IF(VLOOKUP(H3,Credit!H:J,3,FALSE)<(J3*-1),"Not enough Credit... research",IF(VLOOKUP(H3,Credit!H:J,3,FALSE)<(J3*-1),"Additional Credit… Research","No Credit Exists")))
I really would like to have a response to each formula, am I using the wrong functions or the wrong format?
To avoid repeating the VLOOKUP function multiple times you can use SIGN and CHOOSE in this scenario like this
=CHOOSE(SIGN(VLOOKUP(H3,Credit!H:J,3,FALSE)+J3)+2,"Not enough Credit... research","Please Purge","Additional Credit… Research")
If you add the VLOOKUP result to J3 you will get a negative number, zero or a positive number, SIGN function will return -1, 0 or 1 respectively for those and then adding 2 gives 1, 2 or 3 so we can use CHOOSE function to convert 1,2 or 3 to the relevant text value
That formula still gives #N/A error if H3 isn't found in Credit!H:H so to avoid that use IFERROR function (assumes Excel 207 or later), so final version becomes:
=IFERROR(CHOOSE(SIGN(VLOOKUP(H3,Credit!H:J,3,FALSE)+J3)+2,"Not enough Credit... research","Please Purge","Additional Credit… Research"),"No credit exists")
perhaps
=IF(ISNA(MATCH(H3,Credit!H:H,0)),"No Credit Exists",IF(VLOOKUP(H3,Credit!H:J,3,FALSE)=(J3*-1),"Please Purge",IF(VLOOKUP(H3,Credit!H:J,3,FALSE)<(J3*-1),"Not enough Credit... research","Additional Credit… Research")))
the MATCH part looks for the value H3 in Credit!H:H and if it isn't there the ISNA handles the resulting error and returns "No credit exists"; the rest is basically just a tweak of the original formula

Resources