If Cell Value is present in a range of Cells - excel

I have an excel file:
A B C D E F
1000603 90 1000702 Chocolate PCS
1000965 22 1000232 Apple BOX
1008596 56 1555254 Burger PCS
1000323 95 1000702 Candy BOX
1555254 63
1000702 88
Column A and B is my Master List of Barcodes
What I want to do is:
If a value from Column C matches from the Column A, the value in Column B will be placed in Column F
Example:
C D E F
1000702 Chocolate PCS (formula that will be equal to B6) 88
What I have done so far was to play with the answer in this question, but I have not found the correct formula for my need: if a cell equals any cell in a range

Use simple =VLOOKUP function. Put following formula to F1 cell then fill down as required.
=VLOOKUP(C1,A:B,2,FALSE)

Related

Populate summary "table" column based on details "table"

I've tried looking up how this might be done, but it's a bit beyond my excel-fu, unfortunately (I could do it in SQL in a snap!).
Basically, in one worksheet, I have the following details "table" (I've included the column and row labels):
A B C D
1 owner name line # run?
2 A A1 10 Y
3 A A1 20 N
4 A A2 2 Y
5 A A2 14 Y
6 A A3 34 N
7 B B1 26 Y
8 B B1 59 Y
9 B B1 193 Y
10 B B1 194 Y
11 B B2 27 N
12 B B2 51 N
and I have the following summary "table" on a different worksheet
A B C
1 owner name status
2 A A1
3 A A2
4 A A3
5 B B1
5 B B2
I need to populate the status column in the summary "table" based on the run? column in the details "table", linked on the owner and name columns.
Here are the results I'm expecting to get, along with why:
A B C D
1 owner name expected status reason
2 A A1 Partial There are Y and N values for owner=A and name=A1 in the details table
3 A A2 Complete There are only Y values for the owner=A and name=A2 in the details table
4 A A3 Not Started There are only N values for the owner=A and name=A3 in the details table
5 B B1 Complete There are only Y values for the owner=B and name=B1 in the details table
5 B B2 Not Started There are only N values for the owner=B and name=B2 in the details table
I know I'll probably need countifs to work out if there are Y's and N's present, plus an IF to turn the output into the words, it's the getting to the point where I can count the Y's and N's present for each owner+name that I'm struggling with.
I have googled how I might find out if there were Y's and/or N's present for a given owner and name, and have come across this link which involves MATCH and INDEX but for the life of me, I can't get it working - I get an output of #N/A, using the following formula to get the first status:
=INDEX(A2:D12,0,MATCH(c2,'<Detail worksheet>'!A2:D12,0))
Am I on the right lines or is there a better way of doing this? (I could always manually specify the range of rows to look down in the details "table" for each summary "table" row, but I'd like to avoid that if possible!)
I split the formula into two parts, which should get you most of the way there. If you have an uncertain length of data, then be careful with how many rows you examine, my answer only goes to row 13.
Summary Sheet with columns added to split formula
Sheet 1
The formula for the Y column in the above picture is:
=COUNTIFS(Sheet1!$E$3:$E$13,Sheet2!$D$2,Sheet1!$B$3:$B$13,Sheet2!$B3,Sheet1!$C$3:$C$13,Sheet2!$C3)

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

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))),".")

identify duplicates in a column then find the maximum value of adjacent column values in excel

This is a constantly growing file of part names. Each time a part is revised a new test part needs to be made of the revision so we want to keep track of the highest level
Based on duplicates in column A, I am trying to show the current highest rev level (alphanumeric) from column B in column C.
Using the code command I can get a value for the Rev Level up to Z, But I need to account for revision levels beyond Z (AA or AB etc)
PN rev Max Code
1-QR-728 - C 45
4-QR-63 D D 68
2-QR-312 C D 67
1-QR-728 A C 65
28-QR-240 A K 65
2-QR-312 D D 68
6-QR-257 AA AB 65
1-QR-728 B C 66
28-QR-240 K K 75
4-QR-198 - - 45
1-QR-728 C C 67
5-QR-223 D D 68
6-QR-257 AB AB 65
Here is an example that goes in column F and uses a helper column E.
Example in F3
=IFERROR(SUBSTITUTE(ADDRESS(1,MAX(IF($A$3:$A$15=A3,$E$3:$E$15)),4),"1",""),"-")
entered as an array formula with Ctrl+ Shift + Enter and dragged down.
And in column E, example E3
=IFERROR(COLUMN(INDIRECT(B3&"1")),0)
It is based on the revisions matching up with available column names.

formula for finding the first non-empty cell

I have a spreadsheet with 2 columns of data, column A and B, and column C where I'm looking for the formula.
row A B C
1 50
2
3
4
5 56 6
6
7
8 46 10
9
10
11 64 18
As you can see, a row either contains a value or not. In column C, I'm looking to calculate the difference between
a) the value in column B and the value in column A's first non-empty cell directly above (so for example, at row 5, I calculate the difference between B5 and A1 56 - 50 = 6) if the value of B is a number and
b) the value in column A and the value in column B's first non-empty cell directly above (row 8, 56 - 46 = 10)
and put nothing if neither column A and B are empty.
I've been struggling with "first non-empty cell" to write an R1C1 formula. Note that I know I can do this in VBA but I'm looking for the R1C1 formula.
Thanks for your help.
Here is an array formula (that you need to validate with Ctrl + Shift + Enter) you can put in C1 and drag and drop till the end of your data:
=IF(OR(A1<>"",B1<>""),INDEX($B$1:B1,MAX(IF($B$1:B1="",0,ROW($B$1:B1))))-INDEX($A$1:A1,MAX(IF($A$1:A1="",0,ROW($A$1:A1)))),"")
Or, in a french version of Excel:
=SI(OU(A1<>"";B1<>"");INDEX($B$1:B1;MAX(SI($B$1:B1="";0;LIGNE($B$1:B1))))-INDEX($A$1:A1;MAX(SI($A$1:A1="";0;LIGNE($A$1:A1))));"")
Note that if you feel interested, you can commit into Stackoverflow in french
Perhaps try this formula in C2 copied down
=IF(B2="",IF(A2="","",LOOKUP(9.99E+307,B$1:B1)-A2),B2-LOOKUP(9.99E+307,A$1:A1))

Find what cell another cell is referencing

I want to know what column a cell is referring to. Based on the cell it refers to, a different formula will apply.
example:
A B C D E F G
HIGH LOW Choice Gaude
Terry 20 50 50 LOW
Tom 40 1212 1212 LOW
James 101010 121 101010 HIGH
Serra 5 5 HIGH
Sam 50 50 50 LOW
cell E formula
=c2
=c3
=b4
=b5
=b6
cell G formula
=IF(F8=D8,"LOW","HIGH")
The problem is that Sam is meant to be High.
I hope my example helps you understand my predicament.
Are you manually entering the formula in the Choice column E? Maybe it's better to make the Gaude column drive the Choice column instead:
Cell E formula
= If(Exact(G2, "HIGH"), B2, C2)
And instead of changing the referenced column in E, just change G cells to LOW or HIGH as you require.
If I read your quextion correctly, you want a formula that can analyse the formuala contained in another cell, and tell what column it refers to.
You will need a UDF for thism such as
Function WhatColumn(r1 As Range) As Variant
WhatColumn = Range(r1.Formula).Column
End Function
This will return a column number (2 for column B)
You would use this like
=IF(E8=2,"HIGH","LOW")
so if cell E8 contains =B8 WhatColumn will return 2

Resources