SOLVED
Home

Concatenating according to row colours

%3CLINGO-SUB%20id%3D%22lingo-sub-820382%22%20slang%3D%22en-US%22%3EConcatenating%20according%20to%20row%20colours%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-820382%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20original%20pdf%20file%20with%20individual%20level%20information.%20When%20converting%20data%20from%20pdf%20into%20excel%2C%20some%20rows%20concerning%20the%20same%20individual%20were%20mistakenly%20broken%20into%20two%20rows%26nbsp%3B(e.g.%20rows%2013%20%26amp%3B%2014%2C%20rows%2022%20%26amp%3B%2023%2C%20...).%20Thankfully%20adjacent%20rows%20with%20information%20on%20the%20same%20individual%20have%20same%20colour%20(thus%20I%20can%20somehow%20use%20Interior.Color%20inside%20a%20macro).%20So%20basically%20I%20need%20to%20concatenate%20information%20in%20adjacent%20rows%20which%20have%20the%20same%20colour%20into%20a%20unique%20row.%20Note%20that%20the%20way%20that%20rows%20should%20be%20concatenated%20depend%20on%20how%20the%20information%20was%20broken%20down.%20For%20instance%2C%20information%20on%20row%2014%20should%20be%20added%20in%20row%2013%20and%20information%20in%20row%2022%20should%20be%20added%20in%20row%2023.%20Ultimately%2C%20rows%2014%20and%2022%20should%20be%20deleted%20after%20the%20information%20is%20added%20in%20the%20respective%20adjacent%20rows.%20Finally%2C%20the%20spreadsheet%20also%20contains%26nbsp%3Bempty%20rows%20which%20I%20would%20like%20to%20delete%20(e.g.%20rows%2031%2C%2075).%20I%20would%20be%20grateful%20if%20someone%20could%20help%20me%20out%3F%3C%2FP%3E%3CP%3EPlease%20find%20the%20spreadsheet%20attached%20(as%20well%20as%20the%20original%20pdf%20file).%3C%2FP%3E%3CP%3EMany%20thanks%3C%2FP%3E%3CP%3EPaula%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-820382%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-826112%22%20slang%3D%22en-US%22%3ERe%3A%20Concatenating%20according%20to%20row%20colours%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-826112%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F396715%22%20target%3D%22_blank%22%3E%40PaulaSpinola%3C%2FA%3E%26nbsp%3B%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EThis%20is%20very%20easy%20using%20Data%2C%20From%20Table.%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-838708%22%20slang%3D%22en-US%22%3ERe%3A%20Concatenating%20according%20to%20row%20colours%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-838708%22%20slang%3D%22en-US%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F22322%22%20target%3D%22_blank%22%3E%40Jan%20Karel%20Pieterse%3C%2FA%3EI%20am%20afraid%20there%20are%20issues%20in%20the%20names%20of%20the%20institutions.%20For%20instance%2C%20the%20first%20one%20is%20%22FUNDA%C3%87%C3%83O%20HOSPITAL%20ADRIANO%20JORGE%20UNIVERSIDADE%20DO%20ESTADO%20DO%3CBR%20%2F%3EAMAZONAS%22%20and%20in%20the%20file%20you%20sent%20bellow%20it%20is%20%22FUNDA%C3%87%C3%83O%20HOSPITAL%20ADRIANO%20JORGE%20UNIVERSIDADE%20DO%20ESTADO%20DO%26nbsp%3BAMAZONAS%20ONCOLOGIA%20DO%20ESTADO%20DO%26nbsp%3BAMAZONAS%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20think%20I%20managed%20to%20get%20around%20with%20a%20VBA%20code%20that%20identifies%20the%20colours%20of%20each%20row%20and%20some%20subsequent%20formulas.%20Please%20find%20attached.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-838925%22%20slang%3D%22en-US%22%3ERe%3A%20Concatenating%20according%20to%20row%20colours%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-838925%22%20slang%3D%22en-US%22%3E%3CP%3EPerhaps%20this%20one%20does%20work%3F%20(I%20didn't%20take%20the%20trouble%20of%20renaming%20the%20column%20names)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-839055%22%20slang%3D%22en-US%22%3ERe%3A%20Concatenating%20according%20to%20row%20colours%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-839055%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F22322%22%20target%3D%22_blank%22%3E%40Jan%20Karel%20Pieterse%3C%2FA%3E%26nbsp%3Bit%20still%20does%20not%20solve%20the%20issue.%20For%20instance%2C%20in%20cell%20F6%20it%20says%20%22FUNDA%C3%87%C3%83O%20CENTRO%20DE%20CONTROLE%20DE%22%20whereas%20it%20should%20say%20%22FUNDA%C3%87%C3%83O%20CENTRO%20DE%20CONTROLE%20DE%20ONCOLOGIA%20DO%20ESTADO%20DO%20AMAZONAS%22%20which%20was%20split%20in%202%20rows%20in%20the%20original%20spreadsheet.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20issue%20is%20more%20complicated%20than%20it%20seems%20%3CLI-EMOJI%20id%3D%22lia_confused-face%22%20title%3D%22%3Aconfused_face%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20don't%20worry%2C%20I%20already%20managed%20to%20get%20around%20(see%20spreadsheet%20sent%20in%20my%20last%20post)!%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-839077%22%20slang%3D%22en-US%22%3ERe%3A%20Concatenating%20according%20to%20row%20colours%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-839077%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F396715%22%20target%3D%22_blank%22%3E%40PaulaSpinola%3C%2FA%3E%3CSPAN%20style%3D%22display%3A%20inline%20!important%3B%20float%3A%20none%3B%20background-color%3A%20%23ffffff%3B%20color%3A%20%23333333%3B%20cursor%3A%20text%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3E%26nbsp%3B%3C%2FSPAN%3EOK%2C%20in%20that%20case%20I%20won't%20try%20a%20new%20version.%20I'm%20sorry%20my%20solution%20was%20inaccurate%2C%20shouldn't%20have%20been!%3C%2FP%3E%3C%2FLINGO-BODY%3E
PaulaSpinola
Occasional Contributor

I have a original pdf file with individual level information. When converting data from pdf into excel, some rows concerning the same individual were mistakenly broken into two rows (e.g. rows 13 & 14, rows 22 & 23, ...). Thankfully adjacent rows with information on the same individual have same colour (thus I can somehow use Interior.Color inside a macro). So basically I need to concatenate information in adjacent rows which have the same colour into a unique row. Note that the way that rows should be concatenated depend on how the information was broken down. For instance, information on row 14 should be added in row 13 and information in row 22 should be added in row 23. Ultimately, rows 14 and 22 should be deleted after the information is added in the respective adjacent rows. Finally, the spreadsheet also contains empty rows which I would like to delete (e.g. rows 31, 75). I would be grateful if someone could help me out?

Please find the spreadsheet attached (as well as the original pdf file).

Many thanks

Paula

5 Replies

@PaulaSpinola This is very easy using Data, From Table.

Solution

Hello @Jan Karel Pieterse I am afraid there are issues in the names of the institutions. For instance, the first one is "FUNDAÇÃO HOSPITAL ADRIANO JORGE UNIVERSIDADE DO ESTADO DO
AMAZONAS" and in the file you sent bellow it is "FUNDAÇÃO HOSPITAL ADRIANO JORGE UNIVERSIDADE DO ESTADO DO AMAZONAS ONCOLOGIA DO ESTADO DO AMAZONAS".

 

I think I managed to get around with a VBA code that identifies the colours of each row and some subsequent formulas. Please find attached.

Perhaps this one does work? (I didn't take the trouble of renaming the column names)

@Jan Karel Pieterse it still does not solve the issue. For instance, in cell F6 it says "FUNDAÇÃO CENTRO DE CONTROLE DE" whereas it should say "FUNDAÇÃO CENTRO DE CONTROLE DE ONCOLOGIA DO ESTADO DO AMAZONAS" which was split in 2 rows in the original spreadsheet.

 

The issue is more complicated than it seems

 

But don't worry, I already managed to get around (see spreadsheet sent in my last post)! 

@PaulaSpinola  OK, in that case I won't try a new version. I'm sorry my solution was inaccurate, shouldn't have been!

Related Conversations
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies
PacketMon Components are not loading in WAC 1909
HotCakeX in Windows Admin Center on
2 Replies