Looking for an excel formula to execute below:
Column 1 Column 2 Column 3
Row1 "Apple" "Fruit" "X/Y"
Row2 "Banana" "Fruit" "A/B"
Copy data from column 3 (different sheet - "Source") if:
1) Column 2 = "Fruit", AND
2) Column 1 = "Apple"
It should return: "X/Y"
Try something like this:
=INDEX(Sheet1!C2:C99, MATCH(1, (Sheet1!B2:B99="Fruit")*(Sheet1!A2:A99="Apple"), 0))
CtrlShiftEnter
Try this in the cell where you want your answer. Obviously the references (row1col1) should be replaced with actual cell references.
=IF(AND(row1col2="fruit", row1col1="apple"), row1col3, "")
Related
Sheet 1:
Taxon names in column B
Sheet 2:
Taxon names in column A (range defined with the name "Taxon"; A:A)
Names of the parameters in columns C through L (range defined with the name "FeedingType"; C3:L3)
Values linked to the taxa in columns C through L (range defined with the name
"IndexArea"; C4:L1248)
Nature of data: Taxon names on sheet 1 & 2 are not ordered in the same manner, and the taxon names on sheet 1 is a subset of taxa names of sheet 2.
What I want done: I want to copy the values linked to taxa from columns C through L in sheet 2 to the same taxa in sheet 1 in the columns K through T.
So, if I have a "Hydra viridissima (Sheet 2, A6) somewhere in sheet 1, it should bring the values "5" (Sheet 2, J6 under "pre") and "5" (Sheet 2, L6 under "oth") to their respective cells in Sheet 1, which in this case would be in columns R and T.
What I have tried: Went through a tutorial and thought I had it with:
=INDEX(IndexArea,MATCH(B2,Taxon,0),MATCH($K$1,FeedingType,0))
It's not working, though it does identify when things are not matching exactly (#N/B).
I tried to add sheet2! in the formula in reference to names assigned to the ranges like this: =INDEX(Sheet2!IndexArea,MATCH(B2,Sheet2!Taxon,0),MATCH($K$1,Sheet2!FeedingType,0)), but gives the same error.
Can anyone help me out?
Thanks!
Your formula treats Taxon, FeedingType and IndexArea as defined names but your narrative doesn't mention them being assigned defined names. Try it as row and column references.
' in US-EN
=INDEX(Sheet2!$B:$M, MATCH($B2, Sheet2!$A:$A, 0), MATCH(K$1, Sheet2!$B$3:$M$3, 0))
' should the *FeedingType* come from column J?
=INDEX(Sheet2!$B:$M, MATCH($B2, Sheet2!$A:$A, 0), MATCH($J2, Sheet2!$B$3:$M$3, 0))
I need to match data in column A2 and so on in sheet 1 to data in column A2 and so on in sheet 2. If the data in column A of sheet 1 and sheet 2 match I need the data in column B & C of sheet 2 to replace data in column B & C of sheet 1. I know VERY little about doing this kind of stuff so any help would be GREATLY appreciated!
SHEET 1
A B C
2 12345 5.35 9.95
3 15874 4.22 10.99
4 11111 2.24 5.99
5 98745 5.33 9.95
6 88552 4.24 8.95
SHEET 2
A B C
2 11111 2.09 5.79
3 12345 5.11 9.89
4 88552 4.01 8.79
NEED SHEET 1 to change to
A B C
2 12345 5.11 9.89
3 15874 4.22 10.99
4 11111 2.09 5.79
5 98745 5.33 9.95
6 88552 4.01 8.79
On a third sheet use these functions
column a ='sheet1'!a2
column b =if('sheet1'!b2='sheet2'!b2,'sheet2'!b2,'sheet1'!b2)
column c =if('sheet1'!c2='sheet2'!c2,'sheet2'!c2,'sheet1'!c2)
Copy sheet3 and paste the values into sheet1.
This should work unless column a does match. or if you need to do this dynamically. If column a doesn't match some vlookups can be thrown in.
I your data does match in column a your formulas could look something like this.
column a ='sheet1'!a2
column b =if(not(iserror(vlookup(a2,'sheet2'!a:c,2,false))),vlookup(a2,'sheet2'!a:c,2,false),vlookup(a2,'sheet1'!a:c,2,false))
column c =if(not(iserror(vlookup(a2,'sheet2'!a:c,3,false))),vlookup(a2,'sheet2'!a:c,3,false),vlookup(a2,'sheet1'!a:c,3,false))
this is too much to put in a comment so I'm putting it in answer.
The way I under stand is, since sheet1 has more data, you only want to be doing this comparison when sheet1 and 2 both have data on the row. so If sheet1 has data in rows 1 - 100, and sheet2 has data in rows 1 to 50, you only want to be doing this comparison for the first 50 rows in sheet1 right?
So, rather than copying and pasting formulas, what you can do is, in sheet1, find an unused column. go to the first row. in the formula box, type: "=if(" without the quotes. now, select the first cell to compare, according to your example you'd select sheet1, A2. then type "=" without quotes. then select the second cell you want to compare - in your example, sheet2, A2. then type "," without quotes. then select the cell from which you want the data if the first 2 cells are equal. in your example, sheet2 B2. then type "," without quotes, then select the cell with the data to use if the first 2 cells are not equal. in your example, sheet1 b2. then type ")" without the quotes.
so using your example, the function would look similar to how bigtree had it: =if('sheet1'!A2='sheet2'!A2,'sheet2'!b2,'sheet1'!b2)
so, this will compare sheet1 cell A2 with sheet2 A2 and if they are equal, the cell you put the formula in will the have the value of sheet2 b2, and if they are not equal, the cell with this formula will have the value of sheet1 B2. then, drag this formula down for however many rows you want, and the formula will adjust automatically for each row. you'll see the numbers increase. then, select the column with the formulas, right click and select copy, then right click and go to paste special, and click values. this will make it so the column contains only the values, not the formulas, now you can paste this data in column B sheet 1.
you can reuse this formula for whatever columns, just follow the steps.
HTH, good luck!
I asked a very similar question to this one here, but I am trying to identify if a cell's numerical value is contained in a list of cells on a different sheet. If the cell from sheet A matches a cell in sheet B, mark a different column in B with a corresponding row in sheet A, otherwise leave it blank. An example is below:
Sheet A
Column A | Column B
-------------------
1 John
2 Sue
4 Bob
I would like the corresponding Sheet B to populate Column B like this:
Sheet B
Column A | Column B
-------------------
2 Sue
3
4 Bob
=IF(ISNUMBER(MATCH(I2, 'SALT, WOD, Champion Members'!A:A, 0)), "Y", "N")
I have been using the above answer to populate a different column in the same workbook, and I'm thinking I can maybe use this formula, but instead of "Y" or "N", somehow preserve the row.
You need to use VLOOKUP as already mentioned. But you will need to use another function to check for existence of the value, else you will get #N/A against ID 3
I used COUNTIF
=IF(COUNTIF($A$2:$A$4,E2)=0,"",VLOOKUP(E2,$A$2:$B$4,2,FALSE))
Use the VLOOKUP function:
=VLOOKUP(A1;Sheet1!A:B;2;FALSE)
Where A1 is the value you want to look up, Sheet1!A:B is the original sheet with the data.
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
Sheet 1 gets values from Sheet 2.
Sheet 2 has hundreds of rows, but only 4 columns. (Cols A & C are names, Cols B & D are numbers).
Cell XX (sheet 1): Looks in Sheet 2, For "Bill" (col A) and "Jill" (col C) where they BOTH appear in the same row, then returns number from col B (from row where "Bill" and "Jill" are found) to Cell XX in sheet 1.
If "Jill" is in col A and "Bill" is in col C - then conditions are not met, and do not return value.
How do I write this?
I am so confused. PLEASE, someone help me?
Lookup Sheet 2 For "Bill" (Col A2:A300) AND "Jill" (Col C2:C300) Get number in Col B.
One solution is to create a helper column E. Use this formula in the first row (i.e. cell E1):
=$A1 & "-" & $A3
and fill this down for the other rows. If ColA = "Bill" and ColB = "Jill", then ColE will be "Bill-Jill".
You can then do a MATCH to find out with row has "Bill-Jill", and pick up the corresponding value from ColB:
=IF(ISNA(MATCH("Bill-Jill";e:e;0));"No match";INDEX(b:b;MATCH("Bill-Jill";e:e;0)))
The MATCH formula will find out which row contains "Bill-Jill", and the INDEX formula will pick up that row from another column. MATCH will return #NA if there isn't a matching cell, and this will be captured by the ISNA check.
I'm not sure if OpenOffice supports the MATCH function - it's definitely part of Excel though.