Remove all Rows with more than 2 Numbers in it - excel

I want to remove all the rows that contain more than 2 numerical numbers in the A column.
If the value in the A column contains more than 2 numerical numbers in it, then I want to remove it.
Can some one help me with this?
UPDATE
A b C D
12tech
1pics
google9
panda555
jer9gf666
9tom
I want to remove the 1st, 4th,5th rows in the example, because each of those contain more than 2 numbers.

Assuming row 1 is a header row and your actual data starts in row 2, put this formula in cell B2 and copy down:
=SUM(LEN(A2)-LEN(SUBSTITUTE(A2,{1,2,3,4,5,6,7,8,9,0},"")))>1
Then filter on column B for TRUE, delete those rows, and remove the filter

There is no pure-formula way to delete the rows (you can write a VBA macro using regular expressions, but since you didn't say to use macros I'll avoid them), but here is one procedure to find and delete the rows:
1) let B1 be the following formula:
= MIN(
IFERROR(FIND("0",A1),999999),
IFERROR(FIND("1",A1),999999),
IFERROR(FIND("2",A1),999999),
IFERROR(FIND("3",A1),999999),
IFERROR(FIND("4",A1),999999),
IFERROR(FIND("5",A1),999999),
IFERROR(FIND("6",A1),999999),
IFERROR(FIND("7",A1),999999),
IFERROR(FIND("8",A1),999999),
IFERROR(FIND("9",A1),999999)
)
2) fill down column B
3) let C1 be the formula
= MIN(
IFERROR(FIND("0",A1,B1+1),999999),
IFERROR(FIND("1",A1,B1+1),999999),
IFERROR(FIND("2",A1,B1+1),999999),
IFERROR(FIND("3",A1,B1+1),999999),
IFERROR(FIND("4",A1,B1+1),999999),
IFERROR(FIND("5",A1,B1+1),999999),
IFERROR(FIND("6",A1,B1+1),999999),
IFERROR(FIND("7",A1,B1+1),999999),
IFERROR(FIND("8",A1,B1+1),999999),
IFERROR(FIND("9",A1,B1+1),999999)
)
4) fill down column C
5) let D1 be the formula
=C1<999999
6) fill down column D
7) insert a row above the top data row, and set the new A1 = "name" and D1 = "filter"
8) let F1="filter" and F2=TRUE
9) select table (A2:D...), right click, advanced filter
10) set the Criteria range to be F1:F2 and hit OK

Related

Sum of multiple columns if they match

I have this table of data:
A B C D E
003B1016 1 003G1016 1 003B1016
003G1015 1 003G1391 2 003G1015
003H0121 4 003H6208 2 003H0121
003H6209 1 003H6209 1 003H6209
I want to sum B+D if A and C are identical , how would i do that?
I have another 32000 rows of data. :) Thanks for the help
Put this in cell E1 and copy down:
=IF(A1=C1,B1+D1,"")
This says - if A = C, then add B+D. Otherwise, return blank "".
EDIT for new requirements
In order to add all amounts from column B where column A matches the current row and from column D where column C matches that row, where the row in column A exists anywhere and the row in column C exists anywhere, do the following formula in E2 and drag down:
=IF(ISERROR(MATCH(A2,A$1:A1)),IF(ISERROR(MATCH(A2,C:C,0)),"",SUMIFS(B:B,A:A,A2)+SUMIFS(D:D,C:C,A2)),"")
This says: look above the current row in column A - have we seen this item before? If no, continue with the formula. If yes, ignore, to avoid double counting. Then, Look at all of column C - does the value in the current row of A occur anywhere in column C? If no, then don't add anything. If yes, Add all items from column B where column A matches the current row, and add all items from column D where column C matches the current row.

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 :).

Excel: finding a given number criteria meeting cells from right to left

I need to find the average of 8 last (rightmost, from right to left) numeric cell values in a row that meet simple criteria of >= 0, ie. zero or positive numbers from rows that contain a mix of zeroes, and negative and positive values. In other words, I need to find the 8th cell reference from all cells containing 0 or higher counting from the end of the row backwards.
Example row:
1.6425 0.6233 5.2899 4.4372 2.0356 3.9796 1.5306 3.8344 0 -1 -1 3.8294 -1 3.0957 0 3.7572 -1
Expected result:
2.50
(3.7572 + 0 + 3.0957 + 3.8294 + 0 + 3.8344 + 1.5306 + 3.9796) / 8
I solved this cleanly using AVERAGEIFS and adding only one supplementary row A2:Q2 to mark just the 8 cells required. This extra row counts backwards from the end of the row, iterating by one from the previous count (next cell to the right) only if the cell above in row 1 is not less than 0, with the formula =IF(A1<0,B2,B2+1) copied throughout row A2:Q2. This then acts as criteria2 for the main formula i.e. use the first 8 cells from the right with a value >=0.
Then it's a simple =AVERAGEIFS(A1:Q1, A1:Q1, ">=0", A2:Q2, "<9") in cell C4 to get the result. C5 is a simple manual test against the calculated result.
Here's the Excel file: https://dl.dropbox.com/u/4974539/averageifs_tweak.xlsx - and a screen shot:
I solved your problem but with plenty of auxiliary columns. In the following I assume you have your data in columns A to Q, starting in row 2
On the first row, put letters A to J in columns T to AC
On the first data row
2.1 Put the forumula =ROW() in column S
2.2 Put array formula (press Shift + Ctrl + Enter when entering it) =SUM(IF(INDIRECT(T$1 & $S2 & ":Q" & $S2,TRUE)>=0,1,0)) to column T and copy it right all the way to column AC
2.3 Enter array formula =INDEX($T$1:$AC$1,MATCH(8,T2:AC2,0)) in column AD
2.4 Finally, put array formula =SUM(IF(INDIRECT(AD2 & S2 & ":Q" & S2) >= 0, INDIRECT(AD2 & S2 & ":Q" & S2), 0))/8 to column AE, this is the result you want
You can copy the row with formulas down to every row with data
This is how it looks in my Excel:
What it does:
in column S is the current row -- we need it for the INDIRECT function, because ROW() does not work in INDIRECT in array functions.
in columns T - AC we count the number of columns in the right side of the current row of data that are positive or zero, starting in different columns -- their letters are on the first row. The rightmost column where we can start is J, otherwise there would not be
8 values.
in column AD we match number 8 and from the first row we get the column where we have to start the range for averaging
finally, in column AE we use INDIRECT to create the reference to the range we want, sum all the numbers that are >= 0 and divide by 8

Compare in two columns and add value

I have 2 columns looking like this:
Column 1 Column 2
1 x
x 2
2 2
x x
1 2
I want to do two things;
For each row match (row n column 1 = row n column 2) it should mark cell n in column 1 green if there is a match and red if it is not.
It should create a sum cell where each match is worth 1 point, in this case column 1 should result in 2 points.
Is this even possible with excel and if so, how is it done?
For the first part of your question:
It should mark cell n in column 1 green if there is a match and red if it is not
You can do this using Conditional Formatting.
Ex:
Assume column A and column B, with the values starting in row 2.
The following conditional formatting would highlight column A values in green if they match the corresponding value in column B in the same row, otherwise red.
Highlight the values in column A, then apply this conditional formatting.
For the second part of your question
It should create a sum cell where each match is worth 1 point, in this case column 1 should result in 2 points
The following array formula will tally all the matches and show you how many there are:
=SUM(IF(A2:A6=B2:B6,1,0))
Assuming again that we are in columns A & B with your sample data.
Remember to commit this formula using Ctrl+Shift+Enter.
Per comment from andy holaday, here is another formula that will work:
=SUMPRODUCT(N(A2:A6=B2:B6))
or
=SUMPRODUCT(--(A2:A6=B2:B6))
These are not CSE formulas so you would not need Ctrl+Shift+Enter to commit them.

Resources