In Excel I have two columns that equal a third column but they don't equal each other. How do I get them to equal each other? - excel

In Excel I have two columns that equal a third column. How do I get the first two to correspond to each other? Listed below is a small example. Sorry I didn't know to properly paste the Excel into this post. As you can see I have Columns A-E with the titles UPC, Barcode, RMSID, UPC and Barcode. Columns A and D are the same value of a UPC. Both B and C correspond to the UPC column or A and D. I want B and C to correspond to each other since they both share the value of A or D. So if C and D correspond to each other then B does also and I want this to show in Column E. How do I write this in Excel?
A B C D E
UPC Barcode RMSID UPC Barcode
834135001034 102432 883 892773000857 105422
892773000864 105423 884 818780010016 106487
892773000604 105421 888 892773000864 105423
892773000857 105422 900 892773000604 105421
818780010016 106487 910 834135001034 102432

ok, this looks like a straight forward Vlookup or index/ match. In E2 place the following formula:
=Vlookup(D2,$A$2:$C$6,2,0)
D2 is what you are looking up in the first column of A2:C6 where C6 is the bottom right corner of your data. the 2 tells the formula to return the value in the second column. the 0 or false tell the formula to find an exact match for what you are looking for.
you could also do this with an INDEX/MATCH combination. It tends to be preferred as vlookup only looks up information in the left most column and can only return information to the right. INDEX/MATCH does not have to line up vertically and the columns (or rows if you are doing horizontal lookups) can be in any order. I would use the following:
=INDEX($B$2:$B$6,Match(D2,$A$2:$A$6))
Match will tell you what postion from the top of the A2:A6 column the value in D2 was found. Index will then use that value to return the value in the same position from the top in column B2:B6.
When something is not found its going to spit out and error. You can deal with that error using the IFERROR function and either have it return some text to let you know, or return an empty cell with "". Here is one example:
`=IFERROR(VLOOKUP(D2,$A$2:$C$6,2,0),"Not Found")

Related

Match value in column C to data in column A and return all data of column B

I have an Excel file with (for example) 4 columns and I want to search column A for a value mentioned in column C and show in column D all the results that were found in column B separated by a ; and a space.
I got this partly working with the following formula:
=IF(C3<>"";TEXTJOIN("; ";TRUE;IF(($A$2:$A$6=$C2);$B$2:$B$6;""));"")
The thing is, this formula doesn't show any results when the search criteria is not 100% matching.
The following doesn't work:
=IF(C2<>"";TEXTJOIN("; ";TRUE;IF(($A$2:$A$6=("*"&$C2));$B$2:$B$6;""));"")
Perhaps:
=IF(C2<>"";TEXTJOIN("; ";TRUE;IF(ISNUMBER(SEARCH($C2;$A$2:$A$6));$B$2:$B$6;""));"")

group the results of a matching function

i have three columns in excel, one that holds the row id, the next one a product serial number, and the last one again some serial numbers.
098 11079851 11079851
110 11089385 25853201
118 11089385 22412115
798 11079851 22412115
what i need to do, is to find if the value in column B, exists in column C. Then, i need to have a way, to have the values of column B, that were found in column C, grouped, along with their corresponding row ids.
example output of 11079851 that exists in column C:
11079851: 098, 798 perhaps one cell had the row id, and the next ones, each one having a corresponding number from column B, that may be found in column C.
in excel this is what i use so as to get the existance of each cell's value of column B in column C:
=NOT(ISERROR(MATCH(B2,$C$2:$C$1000,0)))
since i do not have excel version required (even 2016 will not have textjoin), i tried the suggested formula from below answer,
=IF(COUNTIF($C$1:$C$4,B1),B1&": "&TEXTJOIN(",",TRUE,IF($B$1:$B$4=B1,$A$1:$A$4,""))"")
but i get a 509 error. What am i missing?
Maybe in D1:
=IF(COUNTIF($C$1:$C$4,B1),B1&": "&TEXTJOIN(",",TRUE,IF($B$1:$B$4=B1,$A$1:$A$4,"")),"")
Enter through CtrlShiftEnter
Drag down...
Note that this would work in Excel2016 or later with TEXTJOIN() enabled.
P.S. I don't have TEXTJOIN() myself and can't test if this works for you.

Excel: Finding next equal match in column

I've googled for a solution to my problem for days and I just can't seem to get my head around how to do this.
I have 28 chickens and I track the eggs each one lays each month. My Excel sheet looks like this:
Current Egg-cel sheet
Column C is populated by the formula:
=LARGE($A$2:$A$29,$B1)
I'm using column B to increment the LARGE function
I want column D to populate with which chicken number laid the quantity in column C.
Obviously INDEX MATCH or VLOOKUP returns the first match for all equal values. How do I find the the next match? i.e.
Egg-cell sheet 2
I've seen similar questions and solutions but I for the life of me can not get it to work.
Use this formula in D2:
=INDEX(B:B,AGGREGATE(15,6,ROW($A$2:$A$29)/($A$2:$A$29=C2),COUNTIF($C$2:C2,C2)))
And drag down
If you're happy to add a few helper columns, this is a simple way to go:
The formula in column C creates a unique number by bringing together the eggs laid and the chicken number
=--(A2&"."&B2)
Column D is just your LARGE formula,
=LARGE($C$2:$C$4,B2)
Column E just gets the integer part of column D
=INT(D2)
And finally Column F gets the decimal part (chicken number) from column D
=--REPLACE(MOD(D2,1),1,2,"")

Excel: Obtain a column by sorting anotr one values

I need to automatically obtain a sorted column of values from another given column values, like in the sample:
I have I need A unchanged, and also B obtained from A
A A B
-----------------
1 1 0
0 0 0
3 3 1
8 8 3
0 0 8
I mean if the values from A changes, the B should change accordignly...
Is that possible in MS Excel?
Here a sandbox and sample:
http://1drv.ms/1SkqMhS
If you put The formula =SMALL(A:A,ROW()) in B1 and copy down then the cells in B will be linked to the cells in A in such a way that the numbers in B will be the numbers in A in sorted order. This won't be efficient for larger ranges but will work fine for small to medium size ranges.
If you want the numbers to start in a lower row, say B2 because you have a header in B1, adjust ROW() to something like ROW()-1.
A word of warning: Use of ROW() can make a spreadsheet somewhat fragile in that formulas that involve it can change their meaning if rows are inserted or deleted or the block containing the formula is moved to somewhere else. Rather than using ROW(), there is something to be said for adding a helper column which numbers the data in A (which would then be in e.g. B) and referring to these numbers rather than small. For example, in:
If I put the formula
=SMALL($B$2:$B$5,A2)
In C1 and copy down, it works as intended. In response to a question you raised in the comments, I added still another column which gives an index where the corresponding value occurs. To do this I wrote in D2 (then copied) the formula
=MATCH(C2,$B$2:$B$5,0)
Of course. Highlight your range and in the Data tab, click "Sort", then you can choose how you want to sort your data:
If column B has information that is to be used with Column A (like next to A1 is "Car"), and you want to sort the whole table, based on Column A, then just select Columns A and B, then sort by column A.
Found the answer, thanks to John Coleman !
Just some minor details like cell value fixing (with $, like A$2)and the -1+ROW adjustment for the 1 header row!

How to return a value to the left of a table array with VLOOKUP?

I need help searching Column E for value=1 and return the value of column A for the same row. VLOOKUP isn't working because there are many columns being searched and there are several 1's in the lookup, and I couldn't seem to search just 1 column using VLOOKUP. Here's how my spreadsheet looks...
A B C D E
1 Name Weight WeightRank Height HeightRank
2 Mike 170 3 6.3 2
3 Richard 200 1 6.0 3
4 Charles 185 2 7.0 1
So I want to search column E for value=1 and return the corresponding value in column A, which in this example would search "HeightRank" for "value=1" and return "Charles"
I tried using =VLOOKUP(1,E:E,1) but that returns an error.
I tried using =VLOOKUP(1,A1:E3,1) but that returns an error.
INDEX(A:A,MATCH(1,E:E,0))
VLOOKUP doesn't work here -- it always searches in the first column of your table and returns a value of a column a given number of columns to the right.
The INDEX/MATCH combination is more flexible, letting you just choose the two columns you want. It's also easier to read (you don't have to count columns to see what it does) and it doesn't break if you insert or delete columns in between the ones you're using, which VLOOKUP does. If you use the trace-formula features, VLOOKUP also falsely implies that all the columns in between are precedents of your resulting formula. (Can you tell that I don't much like VLOOKUP? I just always use INDEX/MATCH and my life is easier for it.)
The OFFSET solution works but it's volatile, so you'll really bog down your worksheet if many cells depend on the result of your formula.
MATCH(x,E2:E4,0) returns the relative position of x in the range E2:E4. For example, MATCH(1,E2:E4,0) returns 3, because 1 is the value of the third cell in the range E2:E4.
OFFSET(A2,r,c) returns the cell r rows and c columns away from A2.
Thus you can say =OFFSET(A2,MATCH(1,E2:E4,0)-1,0) to return the value from column A corresponding to the cell in column E that contains 1.

Resources