Excel - Does Cell contain one of many specific 2 letter sequences - excel

I work in a territory based position, and so I need to separate a list based on UK postcodes
I have a list of my own postcodes and need a formula to check each postcode against my list and give me a true or false value, I have tried 2 variations of 'cell contains one of many things' but I end up with false positives and I am not sure why. The second value should be False.
Many Thanks!

IFERROR(MATCH(D3,$B$3:$B$60,0)>0,FALSE)
MATCH()>0 will generate a TRUE if a match found, but generate an error if no match is found, so IFERROR() comes in handily to translate the error to FALSE.

Related

Read a cell based of numerical input for IF command

I am designing a Material Resource Plan using Excel. I have a two week lead on parts with lot sizes of 90. To auto fill the fields, I would like to be able to input '2' and have Excel recognize that if cell E30 (Planned Order Receipt) has a value, that C31 (Planned Order Release) should display the lot size (as in two weeks prior an order should be placed). Is this type of function possible?
Try
=IF(NOT(INDEX(ISBLANK($D$30:F30),B23)),B24,"")
where $D$30:F30 represents the value of Planned Order Receipt from Week 2 to Week 4. If you have more than 4 weeks, replace F30 with the actual ending cell of this range (and suggest to use absolute cell reference i.e. putting a dollar sign $ in front both column and row ID).
ISBLANK function will check each cell in the range $D$30:F30 is blank (not returned by a formula but a real blank cell), and return a range of TRUE or FALSE.
INDEX function will return the corresponding TRUE or FALSE based on the lead number you entered. If you enter 2, INDEX will return the second value from the range, so on so forth.
NOT function will reverse FALSE to TRUE i.e. TRUE for a non-blank cell. Then IF function will return the lot number as desired, but return a blank "" if that's not the case. You did not specify what you would like to return if the Planned Order Receipt is blank so I just used blank "".
I did some searching today and ask Dr. Google a little differently. I was able to locate this solution using the Offset function:
=OFFSET(C26,4,$B$23,1,1)

Excel Formula: Count repetition factor in a list (Vlookup/Indirect help)

Apologies for the confusing title; I will explain my issue more clearly and detailed here.
So I have a list of booleans that includes a repetitive pattern, and I am trying to calculate the factor by which it repeats. The list will always begin with an unknown number of FALSE values before it begins the cycle and will always end with a TRUE followed by an unknown, but large number of FALSE values.
An example list:
FALSE
FALSE
TRUE
FALSE
FALSE
FALSE
TRUE
FALSE
FALSE
FALSE
TRUE
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
In this case, the factor of repetition I would like is 4 since the pattern repeats every 4 rows (excluding the beginning and end of the list).
I have tried a couple of methods of writing formulas to come up with 4 as the answer including uses of counts, some simple vlookups, and an offset attempt. So far, I have been unable to get a working formula. My guess is that the Indirect function may be of use here, but I haven't been able to wrap my head around the logic of using it yet.
In terms of a general strategy, I'm guessing that if I can find the indices of the rows of the first and second TRUE values, I can simply subtract them to find the repetition factor. (I can easily implement a row number or cell reference column into my spreadsheet if that would help at all too.)
Thanks in advance for any insight!
Try this formula:
=AGGREGATE(15,6,ROW($A$1:$A$17)/($A$1:$A$17),2)-MATCH(TRUE,$A$1:$A$17,0)
The MATCH finds the first row in which there is a TRUE.
The AGGREGATE is working like the SMALL(IF()) Function. when the cell is FALSE it will return a division by 0 error and the 6 in the function overlooks the errors. So the array in which the AGGREGATE is going to pull the second lowest row number is on those rows in which the cell is TRUE.
Edit
Here is a non array formula that does it also, based loosely on #GaryStudents answer:
=MATCH(TRUE,INDEX(A:A,MATCH(TRUE,A:A,0)+1):A1040000,0)
Get the "distance" between two consecutive occurrences of TRUE:
In C1 enter:
=MATCH("TRUE",A:A,0)
and in C2:
=MATCH("TRUE",INDIRECT("A" & C1+1 & ":A9999"),0)+C1
finally in C3:
=C2-C1

if two columns contain specific text, return true in separate column

I am having an issue with coming up with a formula for excel that returns true in a column if two columns before it contain a specific word.
For example,
If Column A and Column B contain "Snow Valley" and "Rain Valley", then Column C returns "TRUE" only if both A AND B contain "Valley"
Does anybody know of an efficient method to do this? Thank you.
As follow up from comments, this works:
=COUNTIFs(A1,"*Valley*",B1,"*Valley*")>0
=not(or(iserr(find("valley",B1)),iserr(find("valley",C1))))
Find() returns #VALUE! If it does not find any match, which explains why i need the iserr(). Iserr() will be True if nomatch and I do Or() to catch the True if any of the two Match() did not contain the word valley. So the Not() makes the True/false behave like you want.

Excel Reverse Match

I'm trying to find a way to do a reverse match in Excel. I have a column of TRUE/FALSE statements and I need to find a way to find both a match and a reverse match within this one column to find the difference between TRUE statements in both directions.
True
False
False
False
True
False
False
True
In this scenario from the perspective of the middle True statement the normal MATCH function going down would return a number of 4. I am trying to find an additional match function that would look upward to the TRUE statement and return a value of 5
Quick and dirty:
A1:A7: TRUE/FALSE
A8: Array formula: {=LARGE(IF(A1:A7=TRUE;ROW(A1:A7);"");1)}
The result will be the row number of the nearest TRUE from below.
The formula is inserted by Shift-Ctrl-Enter in a formula window. Curled brackets are inserted by Excel, not by a user.
If you need the shift from the last TRUE:
{=LARGE(IF(A1:A7=TRUE;ROW(A1:A7);"");2)}
Changing the last number in the formula moves you to the n-th TRUE from below.
Replacing LARGE with SMALL will give the row numbers from above. So it would possible to find the shift between relevant combinations by combining the formulae.

Use Two Different columns to compare to another worksheet

I have two columns that are different from each other. One containing numbers and the other containing text.
Trying to compare (match) both to another separate worksheet.
Of course, I can VLookup each one separatedly but that doesn't give me the answer I'm looking for.
I want to know if the first two columns correlate with the other worksheet.
I also tried an IF(VLookup but probably did it wrong.
To sum it up. If Column A and Column B are both on the other worksheet, then True or False.
Here's a worksheet function that'll do what you want assuming you're only looking in 1 column on worksheet 2. Just replace the values in [] with the actual ranges:
=NOT(OR(ISNA(MATCH([ColumnA],[OtherWorksheet],FALSE)), ISNA(MATCH([ColumnB],[OtherWorksheet],FALSE))))
Here's an example using actual ranges:
=NOT(OR(ISNA(MATCH(A1,Sheet2!A:A,FALSE)), ISNA(MATCH(B1,Sheet2!A:A,FALSE))))
FYI: You could also use this formula for conditional formatting if you don't want to display it in a cell.
Just to explain it:
MATCH will return a number if the value is found, otherwise it will be #N/A.
ISNA will indicate if the result was #N/A.
OR will result in TRUE if either nested ISNA indicates TRUE. (Meaning 1 value wasn't found)
NOT flips TRUE to FALSE and vice-versa.
End result, if both values are found returns TRUE otherwise displays FALSE.

Resources