here is a quick sample of the sheet:
How would I go about looking up multiple criteria? I want to look for the "candy" under "machine3" and return the value next column over ("1" in this case), or look for "cream" under "machine2".
I appreciate any tip on this.
=IFERROR(INDEX($B$1:$B$14,SMALL(IF($A$1:$A$14=E2,IF(ROW($A$1:$A$14)>MATCH("machine"&D2,$A$1:$A$14,0),IFERROR(IF(ROW($A$1:$A$14)<MATCH("machine"&D2+1,$A$1:$A$14,0),ROW($A$1:$A$14)),ROW($A$1:$A$14)))),1)),"Not Found")
This is an array formula - use Ctrl+Shift+Enter while still in the formula bar.
Looks for the match of the product, then evaluates the row against the MATCH() of the machine number and the machine number above it and returns the smallest result.
See the image below. If by "under" you mean anywhere under, then use the formula in E2:
=VLOOKUP(D3,INDIRECT("A"&MATCH(D2,$A$1:$A$14,0)+1&":B14"),2,FALSE)
If by "under" you mean under the machine specified, but before the next machine, then use the formula in F2 (which returns "Not found" if it is not found before the next machine):
=IF(MATCH(D3,INDIRECT("A"&MATCH(D2,$A$1:$A$14,0)+1&":A14"),0)<MATCH("machine*",INDIRECT("A"&MATCH(D2,$A$1:$A$14,0)+1&":A14"),0),VLOOKUP(D3,INDIRECT("A"&MATCH(D2,$A$1:$A$14,0)+1&":B14"),2,FALSE),"Not found")
Write the below formula in B2 Cell and filldown
=IF(AND(A1="machine3", A2="candy"),1,IF(AND(A1="machine2", A2="cream"),1,""))
Related
I am trying to find the "km" value which applies to F2 in the range of D2 to E2 in column A.
I am NOT able to switch column A and B so the "gradient" is to the left of the "km".
In cell G2:
If you want the first match:
=IFERROR(INDEX(A2:A28,MATCH(1,INDEX((A2:A28>=D2)*(A2:A28<=E2)*(B2:B28=F2),),0)),"No Match")
If you want the last match:
=IFERROR(LOOKUP(2,1/((A2:A28>=D2)*(A2:A28<=E2)*(B2:B28=F2)),A2:A28),"No Match")
You may use arrays to get the values:
Notice my formula gets the MAX KM in case there are more than 1 match, but always inside the range delimited by D2 and E2. You can change MAX to MIN,SUM, AVERAGE or whatever you need.
Also, please notice that depending on your Excel version you may need to enter the formula as an array formula so if you got and old version, introduce it pressing CTRL+SHIFT+ENTER
=MAX(IF(B2:B28=F2;IF(A2:A28<=E2;IF(A2:A28>=D2;A2:A28))))
Actually, you can combine this with an aditional IF to check if there is any match first or not with COUNTIF:
=IF(COUNTIFS(B2:B28;F2;A2:A28;">="&D2;A2:A28;"<="&E2)=0;"No match";MAX(IF(B2:B28=F2;IF(A2:A28<=E2;IF(A2:A28>=D2;A2:A28)))))
I want to return the Card used to B2 based on the table to the right.
This returned value should be of the latest date(column G), and the cell to the left of the date should not be blank. If it is blank, return the next latest value.
I have this formula but I want it to return Bank B onto B3 instead of "0" how do i go about achieving this?
=INDEX($F$2:$F$7, MATCH(A2 & MAX(IF($E$2:$E$7=A2,$G$2:$G$7)), $E$2:$E$7 &
$G$2:$G$7, 0))
For this, you need a complex array formula:
=INDEX($F$2:$F$7;MATCH(MAX(IF(IF($F$2:$F$7<>"";$E$2:$E$7)=A2;$G$2:$G$7))&A2;$G$2:$G$7&$E$2:$E$7;0);1)
IMPORTANT!: Because it is an array formula, you will need to type it
as usual, and then, instead of pressing Enter press
CTRL+SHIFT+ENTER
I've tested in my Excel and got this:
Try INDEX/AGGREGATE with a nested AGGREGATE for the conditional MAXIFS (assuming you don't have MAXIFS).
I have an Excel sheet containing a matrix of [Year & Week number] in rows and [name of Employees] in row1 giving values of available weekly hours.
I am able to successfully use the Excel formula
=LOOKUP(2,1/((A:A=2018)*(B:B=31)),D:D)
at cell F2 for a reverse lookup. It gives the result 15 correctly.
However, I wanted to replace range D:D in the above formula to a dynamic range by identifying the column when the employee is known.
So I tried replacing by the formula
SUBSTITUTE(ADDRESS(1,MATCH("Employee2",1:1,0),4),"1","") &":"&SUBSTITUTE(ADDRESS(1,MATCH("Employee2",1:1,0),4),"1","")
This portion of the formula works and gives D:D for Employee2. This is shown to work in cell F4.
But the revised formula gives an error of #Value! at cell F6.
It says "A value used in the formula is of the wrong data type."
The revised formula which does not work is:
=LOOKUP(2,1/((A:A=2018)*(B:B=31)),SUBSTITUTE(ADDRESS(1,MATCH("Employee2",1:1,0),4),"1","") &":"&SUBSTITUTE(ADDRESS(1,MATCH("Employee2",1:1,0),4),"1",""))
I hope someone can help show me where I am making an error in trying to replace range D:D in the LOOKUP formula with the combination of SUBSTITUTE, ADDRESS & MATCH functions.
Thanks to all trying to help in advance.
You cannot just plug a string, which is what SUBSTITUTE returns into a formula.
You can use INDERICT to turn the string into a viable reference:
INDIRECT(SUBSTITUTE(ADDRESS(1,MATCH("Employee2",1:1,0),4),"1","") &":"&SUBSTITUTE(ADDRESS(1,MATCH("Employee2",1:1,0),4),"1",""))
But both INDIRECT and ADDRESS are volatile.
Use instead INDEX to return the correct column:
INDEX(A:AAA,0,MATCH("Employee2",1:1,0))
So your formula is:
=LOOKUP(2,1/((A:A=2018)*(B:B=31)),INDEX(A:AAA,0,MATCH("Employee2",1:1,0)))
I'm developing a financial model and as a completeness check, I need to provide the user with a completeness check that essentially ensures that a range of data does not have any #N/A errors. For example, I'd like the equation in J1 to return "Incomplete" if a single cell in the range A1:A80 has an #N/A value and "Complete" if not a single cell has an error. Any ideas?
Try the following
=COUNTIF(A1:A80,"#N/A")
So
=IF(COUNTIF(A1:A80,"#N/A")>0,"incomplete","Complete")
Though sounds like you want something more broad like:
=IF(SUMPRODUCT(--(ISERROR(A1:A80)))>0,"Incomplete","Complete")
For dynamic range try:
=IF(SUMPRODUCT(--(ISERROR(OFFSET(A1,0,0,COUNTA(A:A),1))))>0,"Incomplete","Complete")
To count #N/A's specifically you can always use something like:
=COUNTIF(A1:A80,VLOOKUP(,,,))
EDIT#1:
This formula relies on a tiny trick, you see this formula:
=VLOOKUP(,,,)
returns a #N/A. We deliberately create an error to count a specific type of error. Another example:
=COUNTIF(A1:A80,0/0)
will count cells with #DIV/0! in them.
(It is equally easy to count cells containing #REF! or #VALUE!)
If you don't need a count, then array enter the formula =OR(ISNA(SomeRange)). Array Enter means type the formula in the formula bar, and push Ctrl Shift Enter
If you want it to return a message, use something like =IF(OR(ISNA(SomeRange)),"Complete", "Incomplete")
If you do need a count, then use =COUNTIF(SomeRange,NA())
Have some problems with one of my formulas in excel.
I have an array of dates, and I want to find if any of them can be found in a cell.
E.g.
C D F G H I J
1 #01/31 #01/30 #01/29 #01/28 #01/27 #01/26 #01/25
And I have my cell A1 containing text: "I want to meet you #01/29"
I get the result I want if I do:
=IF(AND(IFERROR(SEARCH($C$1,A1,1),0)
for each and every of C-J
I would like somthing like
=IF(AND(IFERROR(SEARCH($C$1:$J$1,A1,1),0)
But above do not give anything.
Please help me.
What I want is one formula where I can see if the different dates in C1:J1 can be found in a sentence found in A1.
Two possibilities....
An "array formula"
=IF(COUNT(SEARCH(C1:J1,A1)),1,0)
confirmed with CTRL+SHIFT+ENTER, or a non-array version
=IF(SUMPRODUCT(ISNUMBER(SEARCH(C1:J1,A1))+0),1,0)
You may consider using Match(). It works really well with ranges.
Something like this:
=IFERROR(MATCH(A1,C1:J1,0),0)
Match MSDN
Try this for the wildcard:
=IFERROR(MATCH("*" & A1 & "*", C1:J1 &"", 0), 0)