New Column-Formula

ongengthai1973

Board Regular
Joined
May 6, 2019
Messages
55
Hi Everyone,
I need you guys help. I have questions regrading new column with new formula.

Column Headers "Country" is a new added
After I added new column "Country". I would like the new column show standard data. Below are the standard condition base on data source from "Plant"

1) Penang = Malaysia
2) New York = USA
3) Bangkok = Thailand

ProductPlantCountry
ChassisPenang???
SteeringNew York???
WindowBangkok???
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Book2
ABCDEFGHIJ
1ProductPlantCityCountryProductPlantCountry
2ChassisPenangBangkokThailandChassisPenangMalaysia
3SteeringNew YorkFrankfurtGermanyWindowBangkokThailand
4WindowBangkokNew YorkUSASteeringNew YorkUSA
5PenangMalaysia
6PittsburghUSA
7
8
Sheet9
 
Upvote 0
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="ProductTable"]}[Content],
    tblCityCountry = Excel.CurrentWorkbook(){[Name="CityCountryTable"]}[Content],
    tblMerge = Table.NestedJoin(Source, {"Plant"}, tblCityCountry, {"City"}, "CityCountryTable", JoinKind.LeftOuter),
    tblExpand = Table.ExpandTableColumn(tblMerge, "CityCountryTable", {"Country"}, {"CityCountryTable.Country"})
in
    tblExpand
 
Upvote 0
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    res = Table.AddColumn(
                           Source,
                           "Country",
                           each
                                List.Select(
                                            {{"Penang","Malaysia"},{"New York","USA"},{"Bangkok","Thailand"}},
                                            (x)=>
                                                  x{0}=[Plant]){0}{1}
                         )
in
    res
Book1
ABCDEF
1ProductPlantProductPlantCountry
2ChassisPenangChassisPenangMalaysia
3SteeringNew YorkSteeringNew YorkUSA
4WindowBangkokWindowBangkokThailand
Sheet1
 
Upvote 0

Forum statistics

Threads
1,223,701
Messages
6,173,915
Members
452,537
Latest member
the little giant

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top