Replace AND with NOT function in formula - excel-formula

My Table looks like :
Table.xlsx
* The table needs to be downloaded to get formula works on.
On column "W" I have the following formula :
=IF(AND(J19="HLD";Q19="");"HLD";"")
Which will add value "HLD" in column W if HLD value exist in column J and Column Q is empty.
My problem with this formula is that I have more then one value ( CNA , CFF , HLD ) which needs to be considered as HLD in column W .
When I try to :
=IF(AND(J19="HLD , CNA , CFF";Q19="");"HLD";"")
The formula doesn't work .
Interesting here is that I need all values except STD to be valued as HLD in column W and I was thinking for something like :
=IF(NOT(J19="STD";Q19="");"HLD";"")
But looks like doesn't work.
Other problem which I'm facing in this table is that.
In column X I have the following formula :
=IF(C19="";"";IF(AND(K19="Putaway";MID(J19;1;3)="CFF");0;NUMBERVALUE(C19)))
Which will do the following :
If in column K we have value Putaway and if column J have value CFF will be counted as 0
For the rest of values in K and J columns the formula will copy the value from column C .
My problem with here is that I have more then one value in column J which needs to be counted as 0 . I want all values CNA , CFF , HLD to be counted as 0 or other way around ... all except HLD to be counted as 0 .
Thanks for support

Formula in Cell W2 and drag it down.
=IF(AND(J2<>"STD";Q2="");J2;"")
<> will work as the "NOT" you were after. NOT function in excel is not working in the way you want. The above formula will return the value from Column J as long as the value in column J is not STP AND column Q is blank "".
Formula in Cell X2 and drag it down.
=IF(C2="";"";IF(AND(K2="Putaway";J2<>"STD");0;NUMBERVALUE(C2)))
If you understand the use of `<>' in the last formula, then there is no need to explain further for this one.
Let me know if you have any questions. Cheers :)

Related

Return Multiple Unique Matches in Excel without Array Formula

Given an Excel table of shape
Col. A Col B Col. C Col. D Col. E
x 2 x 2 3
x 3 y 7
y 7 z -5
x 2
z -5
I want to return the first unique hit in Column B for argument "x" in Column D,
the second unique hit in Column B for argument "x" in Column E and so forth.
The formula I'm currently using in cell D1 for this is
{=IFERROR(INDEX($B$1:$B$5,MATCH(0,COUNTIF($C1:C1,$B$1:$B$5)+($A$1:$A$5<>$C1),0)),"")}
which is working.
The problem I'm having is that since this is an array formula and since I'm analyzing a decent amount of data computation time for my sheet is too high.
Is there an alternative for this functionality avoiding an array formula?
Thanks!
Haven't got time to test this properly, but if you have Excel 365 you can use a single formula per row and it may be faster:
=TRANSPOSE(UNIQUE(FILTER(B1:B10,A1:A10=C1)))
in D1.
EDIT
To pull the formula down, you need static references as OP has pointed out. Probably should check for empty cells in column C as well, so formula becomes:
=IF(C1="","",TRANSPOSE(UNIQUE(FILTER(B$1:B$10,A$1:A$10=C1))))

Find all increments of +1's starting from a given number in a column in excel

I have 2 columns x and y
x Y
0 1
1.645 7.897
3.444 6.4387
2.345 5.9090
3.890 5.4322
4.789 3.4321
5.666 4.1111
keeping x at a constant value ( say i pick 3.890) i want to find all increments of +1's of the corresponding Y column . In the above example I want (5.4322 + 1 + 1 + 1 ) upto a certain range.In the above example i want the values (6.4387, 7.987) .If an exact +1 value does not exist i want the closest value to it .Is there a formula i can use to achieve this in excel ? . Any help is much appreciated.
expected output :
New column
5.4322
6.4387
7.897
Suppose you have the following named ranges:
x being values under x column;
y being values under y column;
Pick_x being the selected value from x column.
Enter the following formula in Cell G2 and drag it down to G8:
=IF(INDEX(y,MATCH(Pick_x,x,0))+1*(ROW(A1)-1)>MAX(y),"",INDEX(y,MATCH(Pick_x,x,0))+1*(ROW(A1)-1))
It will return the corresponding y value +1s based on the selected x value, but will show blank if the +1 value is outside the range set by y column.
Then enter the following array formula (confirm by pressing Ctrl+Shift+Enter in the formula bar) in Cell H2 and drag it down to H8:
{=IFERROR(INDEX(y,MATCH(MIN(ABS(y-G2)),ABS(y-G2),0)),"")}
It will return the corresponding closes match from y column based on the value in Column G, and return blank if there is no value in Column G.
I used Column G as a helper column but you can choose to replace G2 in the second formula with the first formula, but it will make the formula too long to be easily understood.
If I change the x value to 4.789, Column H will return the following:
Let me know if I've misinterpreted your question. Cheers :)

Use Excel to look for 2 string values over 2 columns and in one row and return the cell value if there is a match on either of the lookup strings

I would like to have some help with creating an MS Excel 2013 formula that would do the following.
It should look for two string values over 2 columns in one row and should return the cell value of the cell in which the string value was found.
Sorry if I am not explaining myself correctly. Here is an example of the dataset and my expected result
My Dataset have 2 columns A and B but I would like only 1 output in C if ocn OR ocm exist.
I would like to use this formula to normalise this data set.
A B C (Result for ocm or ocn)
(OCoLC)911180191 (OCoLC)ocn911180191 (OCoLC)ocn911180191
(OCoLC)ocn911180196 (OCoLC)911180196 (OCoLC)ocn911180196
(OCoLC)911495338 (OCoLC)ocm911495338 (OCoLC)ocm911495338
(OCoLC)ocm794701569 (OCoLC)794701569 (OCoLC)ocm794701569
Click to see a picture of what I am trying to do
In C2 Cell
=IF(SUM(COUNTIF(A2,{"*ocn*","*ocm*"})),A2,IF(SUM(COUNTIF(B2,{"*ocn*","*ocm*"})),B2,""))
Or
=IFERROR(LOOKUP(2,1/MATCH({"*ocn*","*ocm*"},A2:B2,0),A2:B2),"")
Or
=IFERROR(LOOKUP(2,1/SEARCH({"*ocn*","*ocm*"},A2:B2),A2:B2),"")
Or
=IF(SUMPRODUCT(--ISNUMBER(SEARCH({"*ocn*","*ocm*"},A2))),A2,IF(SUMPRODUCT(--ISNUMBER(SEARCH({"*ocn*","*ocm*"},B2))),B2,""))
Drag the C2 Cell formula down.

Excel vlookup with two columns in source and target returning another column

I have a spreadsheet that has 4 columns sheet 1, and 5 columns sheet2 and I need to do a vlookup on Sheet1!a2&c2 and match the row in sheet2!a2&c2 and return sheet2!c5.
I think Index and Match would do it but all the examples have been matching a single value to an array which isn't what I need for eg.
Can't do attachments yet :( text it is sorry for the format
Sheet1
R1 A B C D
R2 2 D 3 Result will match sheet1!a2&c2 to sheet 2!A3&C3 and return Sheet2!e3 ie 34
Sheet2
R1 A B C D E
R2 2 F 5 GR 72
R3 2 X 3 FR 34
Any links or help?
Update
Sorry I wasn't clear I want to match the cobination of A2 and C2 in sheet 1,
ie in the example =sheet1!A2&sheet1!c2=23
to the values in sheet2!a2 plus sheet2!c2,
ie in this example =Sheet2!a3&Sheet2!c3=23,
and then return the value in Sheet2!E? , ie Sheet2!E3=34 here
I've done this before by creating a cheat column in sheet 2 = a2&c2 in say d2 and filling down then using, assuming 3 rows, however I can't create the cheat column in sheet2
=vlookup(a2&c2,sheet2!d2:e3, 2, false)
The rows sheet2! look like, sorry about the formatting
Picture attached, which I suddenly got to do , where I need to match the yellow columns in the lookup then return the brown column to sheet1!E2 but I can't add the cheat column Sheet2!d2:3 to the sheet cause the user is difficult :)
Thanks again. Any good tutorial on Index?
Try using LOOKUP like this
=LOOKUP(2,1/(A2=Sheet2!A$2:A$10)/(C2=Sheet2!C$2:C$10),Sheet2!E$2:E$10)
The two "tests", i.e.
(A2=Sheet2!A$2:A$10)
and
(C2=Sheet2!C$2:C$10)
return "arrays" of TRUE/FALSE values but when you divide 1 by one of those and then the other TRUE is converted to 1 and FALSE to 0 so you get a resulting array of either 1s (where both conditions are TRUE) or errors [#DIV/0!] where one or both are FALSE.
When you lookup 2 in that array it will never be found so it matches with the last 1, i.e. the match is with the last row where both conditions are satisfied...and the corresponding value from Sheet2!E$2:E$10 is returned. Another way is like this:
=INDEX(Sheet2!E$2:E$10,MATCH(1,(A2=Sheet2!A$2:A$10)*(C2=Sheet2!C$2:C$10),0))
which requires "array entry" with CTRL+SHIFT+ENTER

Excel - move a whole row into the next worksheet if the text in a particular cell of the first worksheet is Y (or Yes)

I am trying to set up a formula where worksheet 1 is a list of dates, names and the final column (I) is a simple Y or N (for Yes or No).
If the answer is Y (or Yes) then I would like the entire row to be copied into the next worksheet (worksheet 2) and if the answer is N (or No) then it does not go onto the next worksheet.
Is this possible to do, and if so how can i do it by cell formula (I don't want to change the srcipt module if possible)?
Any guidance would be gratfeully recieved.
Moving is a 2-step process in Excel (i.e. cut - paste) so this can't be done with a formula.
You could look into
autofilter to display all Y-records within the base data worksheet ... you then can copy/paste them manually
advanced filters to display and even copy Y-records, but within the same worksheet
writing a VBA procedure (not a function) to do the extraction job for you, where you first would set the Y/N field in each record manually, then press a button which moves the records; you gould go as far as capturing the event of entering Y into column 3 to automatically fire the move procedure, but I wouldn't recommend it ... what if the user accidentally entered Y ...
finally you could insert on the extraction sheet an array formula to display the Y-records; example:
Sheet 1
A B C
1 Index Info Flag
2 1 A Y
3 2 B N
4 3 C N
5 4 D Y
Sheet 2
copy headers of sheet 1 into A1..A3
select B1..B3 and enter formula =IF(Sheet1!C2="Y",Sheet1!A2:C2)
press Ctrl+Shift+ENTER to save as array formula
copy B1..B3 down
not very nice though, because you will get a FALSE FALSE FALSE for every N-record
Personally I would prefer 3) ... the button solution
You can do a workaround.
Create another tab or table within the original worksheet that pulls all your rows over via a conditional. This can be done with a VLOOKUP nested within an IF statement. (IF the cell = YES, VLOOKUP the rest of the row). I apologize for not including the exact formula, but its pretty easy to find videos etc on that portion.
On your other worksheet, use PowerQuery to query the original worksheet, and append the rows from your new table.
simply put = sign where u wanna see the result than go to that entire row and drag cursor to downward press enter. that's it.
regard: that's T.J
i entry some data i.e Customer name in Sheet1;s A1 cell , and I use this name in sheet2's cell B1 using this formula =Sheet1!B1 , now I want to move(transfer as CUT ) data from sheet2;B1 to sheet3's "C1" cel , from which formula it can be possible , ples tell
It's not the prettiest solution but it does work and I use it at my job on a workbook for logging checks received. It carries over the row if the check is postdated so that the row appears at the top of the next sheet. And it's an array formula so all the data is contiguous.
Let's use MikeD's data example above and expand upon it:
A B C D E
1 Index Info Flag Index 2 Info 2
2 1 A Y =If(C2="Y",A2,"") =If(C2="Y",B2,"")
3 2 B N =If(C3="Y",A3,"") =If(C3="Y",B3,"")
4 3 C N =If(C4="Y",A4,"") =If(C4="Y",B4,"")
5 4 D Y =If(C5="Y",A5,"") =If(C5="Y",B5,"")
Basically you are adding columns to the right of your data which checks to see if Column C equals "Y" and copies the row one cell at a time. So what we end up with is:
A B C D E
1 Index Info Flag Index 2 Info 2
2 1 A Y 1 A
3 2 B N
4 3 C N
5 4 D Y 4 D
Then on Sheet2 in cell A1 enter the following Array Formula (don't forget to use Ctrl+Shift+Enter):
=IFERROR(INDEX(Sheet1!$D$1:$D$5,SMALL(IF(Sheet1!$D$1:$D$5<>"",ROW(Sheet1!$D$1:$D$5)),ROW(1:1))),"")
Then in cell B1 you would enter a similar Array Formula:
=IFERROR(INDEX(Sheet1!$E$1:$E$5,SMALL(IF(Sheet1!$E$1:$E$5<>"",ROW(Sheet1!$E$1:$E$5)),ROW(1:1))),"")
Then you can highlight A1:B1 and drag the formulas down to A1:B5 and you should see this:
Index 2 Info 2
1 A
4 D
Then you can go back to Sheet1 and hide those nasty looking formula columns :).

Resources