Sorry, Here is an additional question:
I have 2 tables with large amount of data:
Example -
table 1:
Course code Region
100201-200 New York
100201-210 New York
100201-220 New York
101201-300 Los Angeles
101201-310 Los Angeles
101201-320 Los Angeles
101201-330 Los Angeles
102201-400 San Diego
102201-410 San Diego
102201-420 San Diego
...........
table 2 (table 2 contains many fields - doesn't matter what's inside)
Course Code Course Date Course Time etc...........
100201-200 .......................................
100201-210
101201-300 ......................................
101201-320
I need to compare "table 2" against "table 1" and find Course Code from "table 2" which matches Course Code in "table 1" to display what Region from "table 1" associated with "table 2".
Do I have to use vlookup function in MsExcel?
If yes, how exactly...?
Huge thanx for your help!
You need to use VLOOKUP. Here is the syntax for it:
VLOOKUP( value, table_array, index_number, [not_exact_match] )
Have a look at the examples here on MSDN VLOOKUP Manual Page
See also:
Function: HLOOKUP, Function: LOOKUP, Excel Lookup Functions
Related
I have two data sets that are populated from two different tables which can vary in size as those tables change, and I'd like to combine them in to one set of data. I'm completely stumped on how to go about doing this, any ideas?
Please see example of data set 1 and 2, and how I'd like it to look in the right side data in the image :
The data used is as follows:
Data Set 1 Data Set 2 Data Set 1 & 2
Employee Start Date Employee Start Date Employee Start Date
Julie 01/12/2019 Lee 01/12/2019 Julie 01/12/2019
Daisy 01/12/2019 Anna 01/12/2019 Daisy 01/12/2019
Laura 01/12/2019 David 01/12/2019 Laura 01/12/2019
Sam 01/12/2019 Lee 01/12/2019
George 01/12/2019 Anna 01/12/2019
David 01/12/2019
Sam 01/12/2019
George 01/12/2019
If you are on O365 then use VSTACK() formula.
=VSTACK(A3:B5,D3:E7)
If you data increase continuously then could try-
=VSTACK(FILTER(A3:B50000,A3:A50000<>""),FILTER(D3:E50000,D3:D50000<>""))
Edit: If you do not have VSTACK() then go with TEXTJOIN() and FILTERXML() like-
=LET(x,FILTERXML("<t><s>"&TEXTJOIN("</s><s>",TRUE,A3:B20,D3:E20)&"</s></t>","//s"),INDEX(x,SEQUENCE(COUNTA(x)/2,2)))
Here are few more alternatives using VSTACK() & UNIQUE()
• Formula used in cell G2
=UNIQUE(VSTACK(A2:B5,D2:E7))
Or,
• Formula used in cell J2
=LET(rngOne,A2:B5,
rngTwo,D2:E7,
r,SEQUENCE(ROWS(rngOne)+ROWS(rngTwo)),
c,SEQUENCE(,COLUMNS(rngOne)),
output,IFERROR(INDEX(rngOne,r,c),INDEX(rngTwo,r-ROWS(rngOne),c)),
UNIQUE(output))
Edit: We can also accomplish this task using Power Query quite efficiently!
Follow the steps:
Convert the ranges into a table, select any cell on the range and press CTRL T, this will ask you check my table as headers,
Rename the table as DataSetOne, do the same for the second range and rename it as DataSetTwo
Goto Data Tab, From Get & Transform, click on Get Data, from Other Sources and click on Blank Query,
This opens the PQ editor,
Place the below M-Code in Advance Editor which you will find in Home Tab, (remove the M-code which shows for the blank query),
let
SourceOne = Excel.CurrentWorkbook(){[Name="DataSetOne"]}[Content],
DataTypeOne = Table.TransformColumnTypes(SourceOne,{{"Employee", type text}, {"Start Date", type date}}),
SourceTwo = Excel.CurrentWorkbook(){[Name="DataSetTwo"]}[Content],
DataTypeTwo = Table.TransformColumnTypes(SourceTwo,{{"Employee", type text}, {"Start Date", type date}}),
Append = Table.Combine({DataTypeOne, DataTypeTwo})
in
Append
Output:
If all workers are unique (each worker appears just once and there is no common workers between datasets) you can do it easily with consolidate function. You can consolidate 2 or more datasets as long as all of them share headers:
Consolidate data in multiple
worksheets
Notice consolidate is designed to resume data and get a numeric result, but because dates are numbers in Excel, you may use it for this:
So I have a .csv file with thousands of rows that have duplicates area names in column A and "Completed" values on column B (which can be "Completed" or "In Progress" in the same area).
Area
Completed
Chicago
In Progress
Chicago
Completed
Chicago
In Progress
Chicago
In Progress
San Francisco
Completed
San Francisco
Completed
San Francisco
Completed
San Francisco
Completed
Los Angeles
In Progress
Los Angeles
In Progress
Los Angeles
In Progress
Los Angeles
In Progress
I need to make it so that the end product is the following
Area
Completed
Chicago
Particularly Completed
San Francisco
Completed
Los Angeles
In Progress
The idea is to remove the duplicate area values and have the column B be determined by the original values with the following methodology:
if all of the values in an area are "Completed" then column B is Completed
if all of the values in an area are "In Progress" then column B is "In Progress"
if one area contains values "In Progress" and "Completed" then the column B is Particularly Completed
So far I've thought about using a python script for this, but want to know if doing this would be possible with just excel as well?
Formula I have used in D2 cell
=UNIQUE(A2:A13)
Then in E2 cell
=IF(COUNTA(UNIQUE(FILTER($B$2:$B$13,$A$2:$A$13=D2)))>1,"Particularly Complete",UNIQUE(FILTER($B$2:$B$13,$A$2:$A$13=D2)))
and drag down till need.
A correct answer has already been indicated. Anyway, if one doesn't have the UNIQUE or the FILTER function, here is another solution:
A
B
C
D
E
Area
Completed
Chicago
In Progress
=IF(COUNTIF($A$2:A2,A2)>1,"",A2)
=IFERROR(INDEX(C:C,AGGREGATE(15,6,ROW(C:C)/(C:C<>""),ROW(D2)-ROW($D$2)+1)),"")
=IF(D2="","",IF(COUNTIF(A:A,D2)=COUNTIFS(A:A,D2,B:B,"Completed"),"Completed",IF(COUNTIF(A:A,D2)=COUNTIFS(A:A,D2,B:B,"In Progress"),"In Progress",IF(AND(COUNTIFS(A:A,D2,B:B,"Completed")>0,COUNTIFS(A:A,D2,B:B,"In Progress")>0),"Particularly Completed","Unpredicted Outcome"))))
Chicago
Completed
Chicago
In Progress
Chicago
In Progress
San Francisco
Completed
San Francisco
Completed
San Francisco
Completed
San Francisco
Completed
Los Angeles
In Progress
Los Angeles
In Progress
Los Angeles
In Progress
Los Angeles
In Progress
Formulas in column C, D and E has to be dragged down. Column C filters the Area list leaving only unique areas. Column D sort the list of unique areas of column C. Column E gives the actual response. Once could easily obtain a list of unique areas with little work (which could be better if the list is really long), so the "real deal" is just the formula in column E which work on said list.
Or create a Pivot Table on the original data which will look like:
Then in D3 apply your logic =IF(B3>0,IF(C3=0,"Completed","Partially Completed"),"In Progress")
You can then easily add more columns showing proportion of subdistricts completed, or number of districts with only one subdistrict to complete or suchlike.
I have a list of ID's that have multiple countries in a string.
ID Countries
1 DK, US
2 PL, UK
3 CN, RU, DE
4 SE, FI
5 US, FI, DE
6 DK
Then I have a list I want to check if any country exist in this list.
Country Country Code
Sweden SE
Denmark DK
Finland FI
So for example, DK, US should return TRUE since DK exist in Sheet1 list.
I have tried:
=INDEX(Sheet1!A:A;MATCH("*"&Sheet2!B2&"*";Sheet1!B:B;0))
But this dosn't work since I'm trying to match DK, US against DK or SE.
I would like to avoid using VBA or splitting the countries to separate columns. I think help/dummy columns is totally fine but not optimal
I'd use:
Formula in C2:
=SUMPRODUCT(--(FILTERXML("<t><s>"&SUBSTITUTE(B2,", ","</s><s>")&"</s></t>","//s")=TRANSPOSE(F$2:F$4)))>0
Or:
=SUMPRODUCT(--ISNUMBER(FIND(", "&$F$2:$F$4&", ",", "&B2&", ")))>0
Drag down.
I want to add the extra line of Grand Total of the pivot table,
which excludes some element group. Is it possible to do this?
For example, I want to add subtotal of [East excluded New York Total],
is it possible without adding the additional column for grouping purpose from the source data/worksheet?
Because I further want [East + West Total]
and [East excluded New York + West Total]. The approach of adding extra group label columns is not flexible enough as the group subset is not static (i.e., New York sometimes is a subset of East, sometimes not,
for showing subtotal). Thanks.
eg.
East
New York 100
Boston 200
Philadelphia 300
[East excluded New York Total] 500
East Total 600
West
XXX 999
YYY 999
XXX 999
West Total 999
---------------
[East excluded New York + West Total] 999
GrandTotal 9999
Presuming the cities are in Column A and start with A2 and ends wit A5, then resulting cell will be:
=SUMIF(A2:A5, <>"New York", B2:B5)
will do the trick.
Though to be noted, pivot tables were never intended to yield extra rows and it may actively hurt your table structure.
Easiest solution to not get interfering dynamic ranges would be to treat East Coast and Web Coast as seperate Pivot Field Columns instead of Field Rows.
This way, you can apply the formula to entire [#Column]
Got a bit of a pain. So got an interesting issue, basically. Have a long list of entities (200 plus) and I need to match them against a code which I have in another list. So from the entity list, I have the name and country of the entity (Name in column A, country in column D), I need to populate Column F with the code from the other list, or add unknown if a code cant be found.
So, tried to build the query by using the & operator
So =MATCH(A2&D2 to use as key, giving me a value like 'cool companyUNITED KINGDOM'.
In the second list (imported to sheet 2) contains the following columns
Code Name Country
So I want to search an array where Name and country have been combined:
=MATCH(A2&D2,Sheet2!B2:B99999&Sheet2!C2:C99999,0)
I then try to get the index back, so my complete list looks like
=INDEX(Sheet2!A2:C99999, MATCH(Sheet2!A2&Sheet2!D2,Sheet2!B2:B99999&Sheet2!C2:C99999,0))
And all I get back is #Value
Any suggestions
Edit: More infor
So sheet one looks like this (Its column C I need to populate from the code in column A, sheet two)
Entity name Status GIIN Country
Ben Dist Ltd NFFE N/a UNITED KINGDOM
Karamara Sdn Bhd PFFE N/a MALAYSIA
Farbion Trade (Curacao) N.V. LFFI N/a
Tentorim (International) B.V. LFFI N/a NETHERLANDS
Catamo B.V. TLTD N/a NETHERLANDS
Ben Dist Deutschland GmbH FLTD N/a GERMANY
Ben Dist Investments B.V. PFFE N/a NETHERLANDS
Ben Dist Limited TLTD N/a UNITED KINGDOM
Complete Solution Service Limited GLRS N/a UNITED KINGDOM
BDLT S.A. de C.V. TLTD N/a MEXICO
Telsa Telco Services SLTD N/a CHILE
And the second list will look like this
GIIN FINm CountryNm
AAAUG3.99999.SL.764 Asset Plus HSI Fund THAILAND
AABEIL.99999.SL.528 Gresham Capital CLO II B.V. NETHERLANDS
AAB36F.99999.SL.470 Maitland Malta Limited MALTA
AACRQK.99999.SL.756 BBGI GROUP SA SWITZERLAND
AADAD7.99999.SL.528 E-MAC DE 2009-I B.V. NETHERLANDS
AADDBX.99999.SL.060 GWD Limited BERMUDA
AAE9W5.99999.SL.764 Bualuang Money Market RMF THAILAND
AAGH8E.99999.SL.276 Sparda-Bank Baden-Wuerttemberg eG GERMANY
AAGR6U.99999.SL.438 Konsolidationsanstalt LIECHTENSTEIN
AAGWV3.99999.SL.360 BATAVIA PROTEKSI PRIMA 18 INDONESIA
AAGXH0.99999.SL.136 Monarch Capital Partners Ltd CAYMAN ISLANDS
AAHY1V.99999.SL.158 Pingtung County Farmers' Association TAIWAN
AAH0IZ.99999.SL.136 Diversified Absolute Return Fund CAYMAN ISLANDS
I suggest that you use following array formula:
= IFERROR(INDEX(List,SMALL(IF((INDEX(List,,2,1)=A2)*(INDEX(List,,3,1)=D2),ROW(List)-MIN(ROW(List))+1,""),1),1,1),"N/A")
To enter array formula in Windows use Ctrl+Alt+Enter.
On Mac keyboard use Command+Enter.
Then drag the formula downwards.
In this formula I have used named range List, which is equivalent to your Sheet2!$A$2:$C$99999. Named ranges make complicated formulas more readable and flexible.
If you do not want to use named ranges just replace List with Sheet2!$A$2:$C$99999.
=IFERROR(INDEX(Sheet2!$A$2:$C$99999,SMALL(IF((INDEX(Sheet2!$A$2:$C$99999,,2,1)=A2)*(INDEX(Sheet2!$A$2:$C$99999,,3,1)=D2),ROW(Sheet2!$A$2:$C$99999)-MIN(ROW(Sheet2!$A$2:$C$99999))+1,""),1),1,1),"N/A")
It works if your sheets look as follows: