Mapping Fields based on neighbouring cells within a report & can it be scripted?

nickhills1

New Member
Joined
Mar 20, 2024
Messages
8
Office Version
  1. 2021
Platform
  1. Windows
Ladies and Gents.. Hoping to get your expertise.

I have a report which gets generated weekly of new companies who have been added to our database. I want to import this report into a different system, but need to reformat the data to allow it to happen.
At the moment a single company's data is split across multiple rows (based on differing address fields).
I want to pull that data into a single row per company (please see the sample data in the attachment).

The second part of my question is : I will be leaving this company in a months time, but want this process to be super simple for the person replacing me. The report always comes out in the same format, although sometimes with more or less companys to be added.
Is there any way that your solution can be automated, so that when the next person opens next months report, he/she can run a script etc to reformat the data?

Many thanks in advance all

Nick
 

Attachments

  • Current Report.jpg
    Current Report.jpg
    243.8 KB · Views: 3
  • Output Report.jpg
    Output Report.jpg
    59.9 KB · Views: 3

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
I'm not sure if PIVOTBY function is available in Excel 2021. In Excel 365 it is :-), but probably in 2021 not :-(

But If it's not, you may be able to obtain similar result with pivot table, or even better with Power Query:

While active cell in is in "Current Report" data cells Use Data->Get & transform->From Table/Range
In PQ editor select Form Question column (click on header) and use Transform->Pivot. USe Form Item as Value and in advanced options use "Do not Aggregate".
Then Close PQ editor and agree to save results.
Note that operations and cards/groups can have slightly different names as: 1) I use non-English Excel, 2) it is different Excel version

Both in Pivotby and Power Query solutions you can paste new input data over old data and have new results (in PQ it requires right click on result table (green one) and Refresh.

Zeszyt2.xlsx
ABCDEFGHIJKLMN
1Company IDNameblaForm QuestionForm Item CityCountryMailing AddressWhatever
21aaaaCityParis1aaaaParisFrance1 Rue de FunesThis and that
31aaaaCountryFrance2bbbLondonUK10 Buckingham RdThat and something
41aaaaMailing Address1 Rue de Funes
51aaaaWhateverThis and that
62bbbCityLondon
72bbbCountryUK
82bbbMailing Address10 Buckingham Rd
92bbbWhateverThat and something
10
Sheet1
Cell Formulas
RangeFormula
G1:M3G1=PIVOTBY(A:C,D:D,E:E,CONCAT,1,0,,0,,A:A<>"")
Dynamic array formulas.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,576
Messages
6,173,153
Members
452,503
Latest member
AM74

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