Vlookup a Cell which Contains a Part of Other Cell but not that Straightforward - excel

Hi guys and all Excel gurus, I am stuck with this one excel problem which I cannot solve. I tried using Index, Match, Vlookup but to no avail.
Basically I tried getting Column D displays Value from Column B if the Value of Column C contains part of the value in Column A.
So what I'm dealing with is something kind of like this:
Fixed the table display
+------------------------------------------------------+
| Header Column A Column B Column C Column D |
+------------------------------------------------------+
| Row 1 111 AAA 1111 |
| Row 2 222 BBB 112 |
| Row 3 333 CCC 2225 |
| Row 4 444 DDD 333 |
+------------------------------------------------------+
So my expected result would be:
+------------------------------------------------------+
| Header Column A Column B Column C Column D |
+------------------------------------------------------+
| Row 1 111 AAA 1111 AAA |
| Row 2 222 BBB 112 N/A |
| Row 3 333 CCC 2225 BBB |
| Row 4 444 DDD 333 CCC |
+------------------------------------------------------+
Sorry for the poor table display and explanation. Thanks Guys.

=INDEX($C$2:$C$5, MATCH(1,IF(ISERR(FIND($B$2:$B$5, $D2)),0,1),0))
, where 5 is the last data row. Enter as an array formula (Ctrl+Shift+Enter) in E2, then drag down.
BTW on row 4 it gives CCC, not N/A.

Related

Sum up unique values in column per criteria in other column (if values are on the left side of the criteria column)

| A B
---|-----------------------------------------
1 | 1.900
---|-----------------------------------------
2 | 700 Product_A
3 | 700 Product_A
---|-----------------------------------------
4 | 300 Product_B
---|-----------------------------------------
5 | 200 Product_C
6 | 200 Product_C
---|------------------------------------------
7 | 700 Product_D
8 | 700 Product_D
9 | 700 Prodcut_D
10 |
With reference to the answer from this question I wanted to sum up the unique values per product in Cell A1.
Therefore, I tried to go with this formula:
A1 =SUM(INDEX(UNIQUE(IF(SUBTOTAL(2;OFFSET(B2:B9;ROW(B2:B9)-ROW(B2);1;1));A2:B9));;1))
However, as a result now I get 0 instead of 1.900.
I assume the issue results because I have the values on the left side of the criteria column.
Do you have any idea how I need to modify the formula to also make it work in the displayed column order?
All you needed to do was to change the 1 into -1 on the OFFSET():
=SUM(INDEX(UNIQUE(IF(SUBTOTAL(2,OFFSET(B2:B9,ROW(B2:B9)-ROW(B2),-1,1)),A2:B9)),,1))

Excel: copy data within a column based on duplicate values in another column

I have a table as:
(Column A)Company Name | (Column B)Company Number
ABC | 123
ABC |
CBA |
CBA | 234
ACB | 567
ACB |
In Column B I need to insert data in row 2 as row 1 (or vice versa) because row 1 and 2 in Column A have same data. The table i have has about 6M such rows and hence looking for some help.
I think you need filters and then just paste the values you need.

Get last unique row in Excel

I'm having a table looking like this:
id1 | id2 | dateUpdate
==========================================
aaa | 111 | 2016-01-01
aaa | 111 | 2016-01-02
aaa | 222 | 2016-01-05
aaa | 222 | 2016-01-15
bbb | 333 | 2016-01-05
bbb | 444 | 2016-01-01
ccc | 111 | 2016-01-02
I'd like to get only the latest row for each id1/id2 couple:
id1 | id2 | dateUpdate
==========================================
aaa | 111 | 2016-01-02
aaa | 222 | 2016-01-15
bbb | 333 | 2016-01-05
bbb | 444 | 2016-01-01
ccc | 111 | 2016-01-02
Thanks for your help!
Use Aggregate Function
=AGGREGATE(14, 6, 1/($A$2:$A$99=E2)*($B$2:$B$99=F2)*($C$2:$C$99), 1)
You have to put the unique combinations in column E2 and Column F2 downwards
You have five unique combinations
COLUMN A COLUMN B
aaa 111
aaa 222
bbb 333
bbb 444
ccc 111
And Aggregate Funtion is to be put in column G2 and fill down downwards.
=AGGREGATE(14, 6, 1/($A$2:$A$99=E2)*($B$2:$B$99=F2)*($C$2:$C$99), 1)
Regarding Syntax 14 is for Large value that is the for example larger for first aaa 111 combination that is #02-01-2016#
Next digit 6 in formula is for ignoring errors
You can quickly get the pseudo-Last value using the AGGREGATE function..
This is a standard non-array formula that does NOT require Ctrl+Shift+Enter. AGGREGATE was introduced with Excel 2010.
($A$2:$A$99=E2) checks which value of column A matches with the first unique value of column A of unique combination of A & B
This is converted to an array of logical values which gives an array of True Or False. Dividing 1 by these logical values give either 1 or DIV# error. Similar process is adopted for Column B values mentioned in column F. I have taken data limited to 99 rows. If it more number of rows you change the figure of 99 to a higher figure as per your requirements.
HTH
EDIT
You can also go for pivot table solution as suggested by #Tim Biegeleisen in his comments. Snapshot given here-under illustrates that approach.
id1 and id2 are taken as filter fields and Maximum Value of dateUpdate is chosen in the value field.

excel, combine multiple columns into one row

Am new to this so any help would be greatly appreciated.
I have an excel spread sheet with multiple columns, and I want to combine several columns into one column but maintain the same row. i.e.
from:
Name Address Phone1 Phone2 Phone3
Joe box 5 123-456-7890 Null 312-778-2564
Sue 3 w 2nd ST. 345-789-3214 156-879-5461 278-444-5687
Mike box 12 Null 666-879-4518 777-548-9851
To:
name address Phone
Joe box 5 123-456-7890
Null
312-778-2564
Sue 3 w 2nd ST. 345-789-3214
156-879-5461
278-444-5687
Mike box 12 Null
666-879-4518
777-548-9851
Say your information is in columns A and B so:
A | B
1 | z
2 | y
3 | x
To combine A and B in column C you would write the following in cell C1 and copy it down
=A1&B1
The final result would be
A | B | C
1 | z | 1z
2 | y | 2y
3 | x | 3x

how to create relationship in vba for excel?

let's call this table1:
|111|222|333|444|555
--------------------
|6 |6 |4 |3 |3
now lets say i have another table, and i need to use the information from both of them,
table2:
111|aaa
222|bbb
333|ccc
444|ddd
555|eee
I want the result table to look like this:
result table:
aaa|6
bbb|6
ccc|4
ddd|3
eee|3
any ideas?
Use a direct reference to get the first column of your results table:
For the second column, use combination of Index, Match, and HLookup functions:
You can use HLOOKUP.
For example, if you first table is in A1:E2 then you can use:
A B C D E
1 111 222 333 444 555
2 6 6 4 3 3
3
4
5 111 aaa =HLOOKUP(A5,$A$1:$E$2,20 //Returns 6
6 222 bbb
7 333 ccc
8 444 ddd
9 555 eee
Just drag down the formula.

Resources