Combining multiple rows into single row

neo2049

New Member
Joined
Jan 19, 2020
Messages
2
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I hope someone can help.

I have the following table in excel:


1IDCREATED DATEFIELDNEW VALUEOLD VALUE
20012020/01/15LanguageGermanFrench
30012020/01/15Latest Outleta001a002
40012020/01/15Latest OutletParndorfProvence
50022020/01/16LanguageFrenchEnglish
60022020/01/16Latest Outleta002a003
70022020/01/16Latest OutletProvenceAshford
I would like to extract the new data into a new table based on date and New Value:



ID Centre Language

001ParndorfGerman
002ProvenceFrench
I have no idea even where to begin.

Thanks in advance.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Have look on Pivot Table and on AutoFilter
 
Upvote 0
well there's an obvious question to ask here, Neo. Your new name table example is confusing because you've basically transposed the data from the old into the new. so what you've essentially done is the same thing that a person in ms access would do if they want to show financial data, per period, using a cross tab query. is that what you want? furthermore, the question must be asked: what does "language" and "latest outlet" mean? because your new table example indicates that the "old value" comes from the original record entry and the "new value" is the latest record entry. per date. is that true?
 
Upvote 0
well there's an obvious question to ask here, Neo. Your new name table example is confusing because you've basically transposed the data from the old into the new. so what you've essentially done is the same thing that a person in ms access would do if they want to show financial data, per period, using a cross tab query. is that what you want? furthermore, the question must be asked: what does "language" and "latest outlet" mean? because your new table example indicates that the "old value" comes from the original record entry and the "new value" is the latest record entry. per date. is that true?
Sorry, I should've been clearer. I would like to take the values from New Value with Latest Outlet = Centre. The 2nd table didn't format the header row properly. Transposing won't work.
 
Upvote 0
well I do virtually everything by writing code, neo. like I explained earlier. it's very possible that you can do it with pivot-related features like PCL said, or there might even be built-in functions that can do the job. but I posted a solution for you, it would be nothing but a single VBA script to capture the data and put it into a new table on a new sheet, reformatted. what method do you want to go with? I'm headed home now but have to stop quite a few places on the way. I won't be back online until later tonight.
 
Upvote 0
you can try Power Query aka Get&Transform (on Windows, Mac is not supported)
filters.png

Code:
// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Type = Table.TransformColumnTypes(Source,{{"ID", type text}, {"CREATED DATE", type date}, {"FIELD", type text}, {"NEW VALUE", type text}, {"OLD VALUE", type text}}),
    Filter = Table.SelectRows(Table.RemoveColumns(Type,{"CREATED DATE", "OLD VALUE"}), each ([NEW VALUE] <> "a001" and [NEW VALUE] <> "a002")),
    Outlet = Table.FillUp(Table.AddColumn(Filter, "Latest Outlet", each if Text.Contains([FIELD], "Lat") then [NEW VALUE] else null),{"Latest Outlet"}),
    Language = Table.FillDown(Table.AddColumn(Outlet, "Language", each if Text.Contains([FIELD], "Lang") then [NEW VALUE] else null),{"Language"}),
    RD = Table.Distinct(Table.RemoveColumns(Language,{"FIELD", "NEW VALUE"}))
in
    RD
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

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