Excel: search value in array and fetch row and column name - excel

I have a spreadsheet of available samples across 45 boxes, arranged stacked with column headers from 1 to 10 and row headers from A to J. I'm looking for a way to fetch the box, row and cell number if I lookup an ID (prefixed with B).
Sheet 1 is a list of animal IDs that I want to know if a sample is available for
Sheet 2:
Box 1
1 2 3 4 5 ... 10
A B43 B12 B3 B6 B103
B B13 B14 B78 B51 B63
C B78 B33 B99 B43 B92
...
J
Box 2
1 2 3 4 5 ... 10
A B2 B6
I have tried doing nested if functions by columns:
if(match(A2, Sheet2!$B$2:$B$521,0),"1",if(match(A2,Sheet2!$C$2:$C$521,0),"2","")
...but I've been getting #N/A if A2 is in column C.
I've resorted to re-labelling the left-most column to Box 1 A, Box 1 B, Box 1 C... so on, and doing:
=index(Sheet2!$A$2:$A$521,match(A2,Sheet2!$B$2:$B$521,0),0)
...and duplicating the function for **Columns 1 to 10*.
Sheet 1:
Animal ID Col1 Col2 Col3 Col4 ...
B12 . Box 1 A . .
B43 . . . Box 1 C
...
Is there an easier way to fetch the location of a sample from an array?

If your Sheet2 looks like this.
and you want the data like this in Sheet1.
Then enter this formula in Cell B2 of Sheet1 and drag it down and across.
=IFERROR(CONCATENATE(INDEX(Sheet2!$A:$A,(MATCH($A2,Sheet2!B:B,0))-MOD(MATCH($A2,Sheet2!B:B,0)-1,12),)," - ",INDEX(Sheet2!$A:$A,MATCH($A2,Sheet2!B:B,0))),".")

Related

Fill blank cell in Excel with value with same ID

I'm not so advanced in excel I need help if is it possible to do.
I have an excel with this column:
ID - Value1 - Value2
I need to update the value1 (or value2):
- only if are blank AND only if the row has the same ID
I make an example, I have this table:
ID Value1 Value2
A1 1 100
A2 2
A3 3
A4 1 200
A5 2 250
Iwould like to fill all the empty cell in this way
ID Value1 Value2
A1 1 100 200
A2 2 250
A3 3
A4 1 100 200
A5 2 250
Thank you for any help.
Ok, so your data is a mixture of numbers and texts. You can generate two new columns with the desired values using formulas. Choose two new, adjacent columns, say D and E, and enter this CSE formula in row say in cell D2:
D2:
=IFERROR(IF(ISBLANK(B2),INDEX(B$2:B$99,
MATCH(1,($A$2:$A$99=$A2)*(1-ISBLANK(B$2:B$99)),0)),B2), "")
CtrlShiftEnter
Enter the formula in D2 with CtrlShiftEnter and then copy/paste in the cells of columns D and E (or as I said any two adjacent columns).

Get the count of not null values before the cell

As shown in the image in Col2 I need to get the count of not null values in the Col1 before the cell.
For cell B2 there is only one value A hence 1.
For cell B4 it should be 2 as there are 2 values A & C.
Same way for B5, 3 (A,C,D)
Data:
A B
1 Col1 Col2
2 A 1
3
4 C 2
5 D 3
6
7 F 4
I have tried:
B1 Cell = COUNTA(A2:A2)
B2 Cell = COUNTA(A2:A3)
B3 Cell = COUNTA(A2:A4)
However I cannot drag this formula as it will change the cell reference.
Can anyone suggest any way to get this done in a single formula which can be applied to all the cells through out the column.
Try this:
=IF(A2<>"",COUNTA($A$2:A2),"")

Fill empty cells with values from a list in another column

I have the following Excel spreasheet:
A B C
1 =IF(B1<>"",B1;OFFSET(B1,-1,0)) CompanyA
2 =IF(B2<>"",B2;OFFSET(B2,-1,0))
3
4 CompanyB
5 CompanyC
6
7 CompanyD
In column B I have a list of different companies and it might happen that they are empty rows (in this case row2, row3 or row6) between the companies.
In column A I want to achieve that the empty rows are filled with the company names so in the end the spreadsheet looks like this:
A B C
1 Company A CompanyA
2 Company A
3 Company A
4 Company B CompanyB
5 Company C CompanyC
6 Company C
7 Company D CompanyD
I tried to use the If-formula with the offset in column A but it only works when there is not more than one empty row so it only works for CompanyB,C and D but not for company A.
Do you have any idea which formula I have to use in column A to solve this issue?
Pls refer the snap below
In A2 apply the below formula and drag down
=IF(B2<>"",B2,A1)
EDIT #1: Another method if data starts with row 1
if the data starts with B1 then apply the below formula in A1 and drag down
=IF(B1<>"",B1,IF(ROW()=1,B1,OFFSET(A1,-1,0)))
Provided the first cell, say B2, is not empty try with:=B2 in cell A2 and =IF(B3<>"";B3;A2)in cell A3 and fill down.

A function that will lookup a reference

Before I get started thanks for taking your time and helping.
This is what my worksheet looks like:
Row # B C D E F
2 1 Product 1 B2 B3 B4
3 2
4 6
5 1 Product 2 B5 B6
6 5
7 4 Product 3 B7
I was trying to follow this formula: (The best answer one or green check mark) return values from multiple matching rows
I got all the way to the =IFERROR(INDIRECT(lookups!H5),"") but can not get this to work.
What I am tying to do is order the numbers in Column B to go to the right of the product. Which I was able to get the column it is in (B) and the row number it is in (B2). I would like to change the value (B2) to the number that is there.
I would like it to look like this:
Row # C D E F
2 Product 1 1 2 6
3
4
5 Product 2 1 5
6
7 Product 3 4
If someone could help explain this to me or find a better way that would be great.
Not sure what is to happen to columnB but if you replace B with "="B throughout columns D:F then select each of these in turn and apply Text to Columns with Tab as the delimiter the 'cell references' convert to formulae referring to the values in B. If you want to delete columnB copy D:F and Paste Special, Values over the top.

extract data from column based on subset of data from other other column

This is how my data looks like:
C1 C2 C3
1 1 a
2 2 a
3 3 a
4 4 a
7 5 a
8 6 a
9 7 a
10 8 a
9 a
10 b
You see that C1 is a subset of column C2. I want now to extract only the data from C2 - together with the corresponding value from C3 - that matches C1. The extracted data just needs to be copied to another column
Could someone give me a hand?
Assuming your data in C1 starts from A2, do the following:
Type in cell D2 (column C4): =IFERROR(VLOOKUP($A2,$B:$C,1,0),"")
Type in cell E2 (column C5): =IFERROR(VLOOKUP($A2,$B:$C,2,0),"")
Autofill both formulas.
This will give you what you want, missing values will be shown as blanks. If you want concatenate both parts of out - just put the aggregate formula =ISERROR(...)&ISERROR(...) to any column row 2 you like.
Sample file: https://www.dropbox.com/s/qglyxmu3tkfxy7g/DataExtract2Cols.xlsx

Resources