Excel sheet merging different column - excel

Having an excel file as shown as below:
First sheet:
| Animal_with_age|
|----------------|
| Animal-Dog123L |
| at-cat234L |
| MS-Donkey12 |
| occoco98L |
| Ms-dog donkeyone|
Second sheet:-
| Animal |
|-------------- |
| Dog |
| CAT |
| Donkey |
| coco |
| dog donkeyone |
I need the output as below:
sheet 1:
| Animal_with_age|Animal|
|----------------|------|
| Animal-Dog123L |Dog |
| at-cat234L |Cat |
| MS-Donkey12 |Donkey|
| occoco98L |coco |
|Ms-dog donkeyone| dogdonkeyone|
Is that possible? Is that possible if i convert to dataframe?

Using Filter, INDEX-MATCH & SEARCH formulas, we can do full to partial string matching...
=INDEX(FILTER(Sheet2!$A$2:$A$6,ISNUMBER(SEARCH(Sheet2!$A$2:$A$6,Sheet1!A2)),0),MATCH(MAX(LEN(FILTER(Sheet2!$A$2:$A$6,ISNUMBER(SEARCH(Sheet2!$A$2:$A$6,Sheet1!A2)),0))),LEN(FILTER(Sheet2!$A$2:$A$6,ISNUMBER(SEARCH(Sheet2!$A$2:$A$6,Sheet1!A2)),0)),0))
Output of sheet1 -> Paste formula in sheet1 cell b2 & drag till last row;
Hope this Helps...

Related

Find cell address of value found in range

tl;dr In Google Sheets/Excel, how do I find the address of a cell with a specified value within a specified range where value may be in any row or column?
My best guess is
=CELL("address",LOOKUP("My search value", $search:$range))
but it doesn't work. When it finds a value at all, it returns the rightmost column every time, rather than the column of the cell it found.
I have a sheet of pretty, formatted tables that represent various concepts. Each table consists of
| Title |
+------+------+-------+------+------+-------+------+------+-------+
| Sub | Prop | Name | Sub | Prop | Name | Sub | Prop | Name |
+------+------+-------+------+------+-------+------+------+-------+
| Sub prop | value | Sub prop | value | Sub prop | value |
+------+------+-------+------+------+-------+------+------+-------+
| data | data | data | data | data | data | data | data | data |
| data | data | data | data | data | data | data | data | data |
⋮
I have 8 such tables of variable height arranged in a grid within the sheet 3 tables wide and 3 tables tall except the last column which has only 2 tables--see image. These fill the range C2:AI78.
Now I have a table off to the right consisting in AK2:AO11 of
| Table title | Table title address | ... |
+---------------+-----------------------+-----+
| Table 1 Title | | ... |
| Table 2 Title | | ... |
⋮
| Table 8 Title | | ... |
I want to fill out the Table title address column. (Would it be easier to do this manually for all of 8 values? Absolutely. Did I need to in order to write this question? Yes. But using static values is not the StackOverflow way, now, is it?)
Based on very limited Excel/Google Sheets experience, I believe I need to use CELL() and LOOKUP() for this.
=CELL("address",LOOKUP($AK4, $C$2:$AI$78))
This retrieves the wrong value. For AL4 (looking for value Death Wave), LOOKUP($AK4, $C$2:$AI$78) should retrieve cell C2 but it finds AI2 instead.
| Max Levels |
+------------------+---------------+----+--+----+
| UW | Table Address | | | |
+------------------+---------------+----+--+----+
| Death Wave | $AI$3 | 3 | | 15 |
| Poison Swamp | $AI$30 | | | |
| Smart Missiles | $AI$56 | | | |
| Black Hole | #N/A | 1 | | |
| Inner Land Mines | $AI$3 | | | |
| Chain Lightning | #N/A | | | |
| Golden Tower | $AI$3 | | | |
| Chrono Field | #N/A | 25 | | |
The error messages for the #N/A columns is
Did not find value '<Table Title>' in LOOKUP evaluation.
My expected table is
| Max Levels |
+------------------+---------------+----+--+----+
| UW | Table Address | | | |
+------------------+---------------+----+--+----+
| Death Wave | $C$2 | 3 | | 15 |
| Poison Swamp | $C$28 | | | |
| Smart Missiles | $C$54 | | | |
| Black Hole | $O$2 | 1 | | |
| Inner Land Mines | $O$28 | | | |
| Chain Lightning | $O$54 | | | |
| Golden Tower | $AA$2 | | | |
| Chrono Field | $AA$39 | 25 | | |
try:
=INDEX(ADDRESS(
VLOOKUP(A2:A3, SPLIT(FLATTEN(D2:F4&"​"&ROW(D2:F4)), "​"), 2, ),
VLOOKUP(A2:A3, SPLIT(FLATTEN(D2:F4&"​"&COLUMN(D2:F4)), "​"), 2, ), 4))
or if you want to create jump links:
=INDEX(LAMBDA(x, HYPERLINK("#gid=1273961649&range="&x, x))(ADDRESS(
VLOOKUP(A2:A3, SPLIT(FLATTEN(D2:F4&"​"&ROW(D2:F4)), "​"), 2, ),
VLOOKUP(A2:A3, SPLIT(FLATTEN(D2:F4&"​"&COLUMN(D2:F4)), "​"), 2, ), 4)))
Try this:
=QUERY(
FLATTEN(
ARRAYFORMULA(
IF(
C:AI=$AK4,
ADDRESS(ROW(C:AI), COLUMN(C:AI)),
""
)
)
), "
SELECT
Col1
WHERE
Col1<>''
"
, 0)
Basically, cast all cells in the search range to addresses if they equal the search term. Then flatten that 2D range and filter out non-nulls.

I want to count IF both condition are true Logically count by AND excel

I have two Columns both are categorical columns. Like Age_group and Engagement_category. And I want to get count no. of each engagement_category in each Age_group.
This is like GROUP BY function in SQL.
| Engagement_category | Age_group |
|:-------------------:|:---------:|
| Nearly Engaged | 21-26 |
| Not Engaged | 31-36 |
| Disengaged | 36-41 |
| Nearly Engaged | 21-26 |
| Engaged | 21-26 |
| Engaged | 26-31 |
I tried Excel COUNTIFS function but it is showing the count of each unique value in the criteria range that I have provided.
Expected OUTPUT is something like this.
| Age_group | Engaged | Nearly Engaged | Not Engagaged | Disengaged |
|:---------:|:-------:|----------------|---------------|------------|
| 21-26 | 1 | | | |
| 26-31 | | | | |
| 31-36 | | | | |
| 36-41 | | | | |
| 41-46 | | | | |
| 46-51 | | | | |
Thanks!
Use COUNTIFS function, see document: https://support.office.com/en-us/article/countifs-function-dda3dc6e-f74e-4aee-88bc-aa8c2a866842
Please try:
=COUNTIFS(B:B, "21-26", A:A, "Engaged")
Try inserting a pivot table:
Highlight the source data which is the 2-Column table including headers, go to Insert tab and click the Pivot Table button, set up the Rows, Columns and Values column as below:
The key is to drag the Engagement_Category to both Columns and Values field.

Excel search range of cells that contain text return entire cell that contains text

I am trying to get a formula to check a set of data for a certain text. For example, assuming the below table starts in Cell A1, I would like to search Columns C,D,E,F,G for a string, and return the entire contents of the cell that contains that string. So for the "AltID 101020", I would like to search columns C-G for the string "Plan" and return the value of "Plan11" in B2, "Plan88" in B5, and "Plan2d" in B7.
A B C D E F G
Data Column1 Column2 Column3 Column4 Column5 Column6
+--------+-------+-------+-------+-------+-------+-------+
1 | AltID |Plans | CovA | CovB |CovC | CovD | CovE |
+--------+-------+-------+-------+-------+-------+-------+
2 | 101020 | | Pol3 |Plan11 | | |Coord2e|
3 | 907030 | | Pol | | Sub5a | Alt24 | |
4 | 805050 | | | | | | |
5 | 778050 | | |Plan88 | Sub7d | |Coord2 |
6 | 232520 | | | | | | |
7 | 357031 | | |Plan2d | Sub7e | | |
8 | ... | ... | ... | ... | ... | ... | ... |
+--------+-------+-------+-------+-------+-------+-------+
Using this formula, you can see if there is the word "plan" in a cell or not. In case not there is an empty string. You can concatenate all those in one cell, and use a MATCH function for using it:
=IF(ISERROR(FIND("plan";D2));"";D2)

VBA-Compare sheets and copy values from second sheet

I am trying to compare two workbooks and copy the 5th column to the 5th column first workbook if the first 3 columns match.
This check has to be done throughout the worksheet.
Worksheet 1:
| Heading 1 | Heading2 | Heading 3 | Total | Number1 |
|-----------|----------|-----------|-------|---------|
| ABC | EF | GH | | |
| XYZ | AB | EF | | |
| HIK | IJ | PQ | | |
Worksheet 2:
| Heading 1 | Heading2 | Heading 3 | Total | Number1 |
|-----------|----------|-----------|-------|---------|
| QRS | EF | GH | | 5 |
| XYZ | AB | EF | | 4 |
| DEF | QR | IV | | 16 |
| HIK | IJ | PQ | | 8 |
Desired output:
| Heading 1 | Heading2 | Heading 3 | Total | Number1 |
|-----------|----------|-----------|-------|---------|
| ABC | EF | GH | | |
| XYZ | AB | EF | | 4 |
| HIK | IJ | PQ | | 8 |
I tried to do the following, but it didn't work:
Dim i As Integer
Sheets("Sheet1").Activate
For i = 2 To 100
ActiveSheet.Cells(i,5).Select
ActiveCell.FormulaR1C1 = "=IFERROR(IF(AND(Table2[#[Heading1]]=Consolidated!RC[-4],Table2[#[Heading2]]=Consolidated!RC[-3],Table2[#[Heading3]]=Consolidated!RC[-2]),Table2[Number1],"" ""),"" "")"
Next i
I am a VBA novice and would be grateful for any help.
You can do this with formulas, no need for code. I'll assume that "Heading 1" is in cell A1 for this: Add a new column between heading 3 and Total. In the first cell add the formula =A2&B2&c2 and copy down. Do the same in the other workbook. Now in Number1 in the first book enter this formula
=IFERROR(OFFSET([OtherWorkbook]SheetName!D2,MATCH(D2,[OtherWorkbook]Sheetname!D2:D5),2),"")
(Using your workbook and sheet names. Now copy down. You can then hide the column we added at the start by setting its width to zero in both books.

Microsoft Excel - Use a drop down list to extract data from another workbook

If i select an option from a drop down list, how do i then display data extracted from another workbook. So far, i have seen examples of showing single row data from another worksheet. But i have yet to see a method of extracting multiple rows and columns of data from a different workbook.
Week 1.xls:
A B C
-------------------------------------------------
| SKU | Description | Vendor Style |
-------------------------------------------------
| | | |
| 000001 | Description 1 | CA0080-03E |
| 000002 | Description 2 | EX1134-59D |
| 000003 | Description 3 | EM0132-59A |
| 000004 | Description 4 | EW8694-52D |
| 000005 | Description 5 | FC0003-18D |
| 000006 | Description 6 | EK2273-59E |
Master.xls:
A B C
------------------------------------------------- ________ _
| SKU | Description | Vendor Style | |________|>| <---Drop Down List
-------------------------------------------------
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
If i choose, e.g. Week 1 in the drop down list. I want the data from Week 1.xls to fill in the table in Master.xls.
If i choose, e.g. Week 2 in the drop down list. I want the data from Week 2.xls to fill in the table in Master.xls.
Is this possible? I'm thinking vlookups may be involved here in order to point to each workbook.
Thank you.

Resources