You are here:

Excel/put two rows in one


Dear Mr. Ogily,

i hope that you can help me..
i need to put two rows which have the same value in one cell into one row... the best would be at the end of the first row like below..
ID   A   B   C
119   10   7   5
119    9   8   4
119   10   7   5 119    9   8   4

is this possible.??
thank you in advance

concatenate data
concatenate data  

A2:  119
B2:  10
C2:  7
D2:  5
A3:  119
B3:  9
C3:  8
D3:  4

then in E2 you could put a formula

E2: =if($A3<>$A2,na(),B3)

then select and drag fill to G2

Now select E2:G2 and drag fill down your column.

That would be my initial approach.  I would need to know much more about your layout to say more than that.

If you look at the attached image,  you will see that the rows you want to delete have
#N/A errors displayed in columns E, F and G.  If every ID had two rows of data, then I could select columns E:F and do an copy, then paste special and values to replace the formulas with the values they produce.  Then I could select column E and hit F5 to get the goto dialog - then select the special button and in the resulting dialog, select Constants, and uncheck everything except Errors and click OK.  I would then have all the rows to delete selected in column E.  I could then choose Delete entire rows and all the 2nd rows would be removed.

But that would work best in the situation I describe.  I don't know what your situation is.

Tom Ogilvy

About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Tom Ogilvy


Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]


Extensive experience.

Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.

©2017 All rights reserved.

[an error occurred while processing this directive]