Using Search Formula in Row - excel

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)

Related

How to concat 2 cells in excel

I have it in my cells A5:
A:E
and in my cell B6, I have it :
3
I try to say in other cells :
A3:E3
to select all row from A3 to E3
I tried to use Concat with excel but it put me error
thanks for reading me
EDIT
Is this what you are trying to achieve, as BigBen Sir, rightly mentioned you need INDIRECT Function
=INDIRECT(LEFT(A5)&B6&":"&RIGHT(A5)&B6)
If you dont want to use INDIRECT Function as just show as A3:E3, then simply,
=LEFT(A5)&B6&":"&RIGHT(A5)&B6
An INDEX/INDIRECT Combination
This looks like the most 'elegant' solution to me:
INDEX(INDIRECT($A$5),$B$6,) ' short for INDEX(INDIRECT($A$5),$B$6,0)
Credits should also go to P.b, who figured it out earlier in the comments.
It took me a while since I started with the wrong formula INDEX(INDIRECT($A$5),$B$6) ignoring the column argument.
Only when I realized that =COLUMNS(INDIRECT($A$5)) returned 5, I got back to INDEX and figured it out.
Here are a few examples of how you can utilize it:
=COUNT(INDEX(INDIRECT($A$5),$B$6,))
=SUM(INDEX(INDIRECT($A$5),$B$6,))
=AVERAGE(INDEX(INDIRECT($A$5),$B$6,))
Try:
=LEFT(A1;FIND(":";A1)-1)&A2&RIGHT(A1;FIND(":";A1))&A2
A2 contains "3", A1 contains "A:E"

Combining IF, ISTEXT and LEN functions

My current formula:
=IF((LEN(J3))=4,J3,IF(J3="","",IF(ISTEXT(J3),"",J3)))
What I'm trying to achieve with this formula:
if any cell in column J istext then return as blank.
Shorten 68148101 to show as = 8148
Can't seem to get these two formulas to work together..
Based on you requirements in your comment, try the following in A2:
=IF(J2="","",IF(ISTEXT(J2),"",IF(LEN(J2)>4,MID(J2,2,4),J2)))

Excel: lookup multiple criteria but same column

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,""))

Include a range of cells for If/Then statement

I have an IF statement that I want to have my 'true value' be true if (one of a range of cells values exist
=IF('Table Values'!C4='Table Values'!B84, 'Table Values'!C3, "<N/A>")
I want B84 to be B81 through B84
I tried
=IF('Table Values'!C4='Table Values'!B81:B84, 'Table Values'!C3, "<N/A>")
but that just shows #Value error in the cell
FYI - If this answer already exists tell me what my search criteria should have been to find my answer
Say we have happiness in cell A1 and we want to know if this can be found anywhere in column B. Use this formula:
=IF(ISNUMBER(MATCH(A1,B:B,0)),"Its there","no happiness")
Summarizing your question if in range B1:B4 there is the value in C4 you want to output C3. Please correct me if this is wrong. Based on this context, please consider the following formula:
{=IF(OR(C4=B81:B84),C3,"")}
Notice that the curly brackets represent that this formula is an array formula done by pressing CTRL + SHIFT + ENTER when inputting the formula. If you don't input it as an array formula it will only compare C84 with the top left most cell of the B81:B84 range (ie B81).
I can think of numerous other approaches to this, for example using a COUNTIF but I strived to follow your approach. Hope you find this useful. Cheers.
This gave me the closest solution, but now I have a problem expanding with the 'range' for other similar situations
=IF(ISNUMBER(MATCH('Table Values'!C4,'Table Values'!B84:B86)),"'Table Values'!C3"," ")
** Note: what is confusing to me about this is the 'isnumber', I am using 'text' not numbers, so that is why i did not consider it when i searched initially
And I now need to know how to use this for ranges with gaps
Example: instead of range B84:B86 I want my range to be B84:B86 and one other range C84:89.

Nested IFs in function not working

Hi, I'm trying to input a function in C2 in order to assign a numerical value to the minutes given in Column B. The criteria for this can be seen in the image above (starting at G1).
I have tried using a formula I copied from a similar situation but is not working:
=IF(B2<=$A$2,5,IF(B2<=$A$3,4,IF(B2<=$A$4,3,IF(B2<=$A$5,2,1))))
Any help would be appreciated, thanks
The suggestion by #Jeeped above will simplify the formulas needed. If you have to keep the 'A' and 'B' cells as they are listed above, you have to extract the number from the 'x min' format and convert the 'x' to a number so it can be compared (I assume a " " exists after the number. Could search for " min" as well).
=VALUE(LEFT(A2,SEARCH(" ",A2)-1))
Using the above, if A2 = '60 min', the formula will produce a '60'.
Now that the cell contents can be treated as numbers, the comparisons can be made. Formula for C2:
=IF(VALUE(LEFT(B2,SEARCH(" ",B2)-1))<=VALUE(LEFT($A$2,SEARCH(" ",$A$2)-1)),5,
IF(VALUE(LEFT(B2,SEARCH(" ",B2)-1))<=VALUE(LEFT($A$3,SEARCH(" ",$A$3)-1)),4,
IF(VALUE(LEFT(B2,SEARCH(" ",B2)-1))<=VALUE(LEFT($A$4,SEARCH(" ",$A$4)-1)),3,
IF(VALUE(LEFT(B2,SEARCH(" ",B2)-1))<=VALUE(LEFT($A$5,SEARCH(" ",$A$5)-1)),2,1))))
This is ugly, but works given the original question.
Try this formula (in this case for C2):
=SUM((B2<=$A$2:$A$5)*1)+1
It is important to use it as array formula. So after typing or inserting this formula to your cell don't just commit with Return but hit Ctrl+Shift+Return. If you did it right, your formula will be surrounded by curly brackets in formula bar:
{=SUM((B2<=$A$2:$A$5)*1)+1}

Resources