Move content from 1 column to 3 columns - excel

I have long file with this content:
John Doe1
Street Foo 35
New York
Mary Johnson
Street Foo 49
Los Angeles
Robert Deniro
Street Bar 47
Washington
...
As you can see there is one column with Name, Address, Town, Name, Address, Town..
I would like to convert it automatically to a file with 3 colums:
John Doe1 Street Foo 35 New York
Mary Johnson Street Foo 49 Los Angeles
Robert Deniro Street Bar 47 Washington
...
Is that possible?
Excel 2007/Windows 7

Based on this similar answer, and assuming your data lays in A1:A50 (you can extend this range in the formulas below as needed), then:
Cell B1: =INDEX($A$1:$A$50,ROW()*3-2,1)
Cell C1: =INDEX($A$1:$A$50,ROW()*3-1,1)
Cell D1: =INDEX($A$1:$A$50,ROW()*3,1)
This gives you one line of rearranged data. Copy B1:D1 downwards, as far as needed.

I am sure answered many times (and in different ways) on SO already but since I can't presently find an example you might try:
Add a column with =MOD(ROW(),3) copied down to suit and convert to values. Copy your data column twice, deleting top cell from first copy and top two cells from second. Filter to delete rows other than with 1 in what was the MOD column.

Related

How to search through an array of rows for a partial string in excel

I am used to Excel but am still pretty new to more complex formulas. I am trying to fill in the id field in the data table automatically based on the name.
I have two tables, one is a list of employees, and another is a log of associates' actions.
Here is the ID list.
A5 ID
A6 Name
123
Foo Bar
321
John Doe
246
Jane Doe
135
Mike Jones
Here is the log list.
A1 ID
A2 Name
A3 Action
Jane Doe
xxxxx
John Doe
abcdefg
Jane Doe
zzzzz
Foo Bar
yyyyyyy
I want to be able to take the current cell's index in the log and compare the name to the list of employees and copy the cell to the left of it to get the id.
Do you know of any formulas that would guide me to my goal?

Excel - Append cell2 to cell1 if cell3 is not blank

All,
I've taken a browse around and I've been unable to nail down the formula I'm looking for. I'm a bit new to Excel expressions, so this is all part of the learning process.
My quandary:
I have a list of names in an Excel spreadsheet - some have two components and some have three. I need all names to have only two components - if they have three, then the first two components need to be combined.
Here is my workflow:
IF cell 3 is occupied, append the content of cell 2 to the end of cell 1 IN cell 1. Then, assuming cell 2 is now blank, move the content of cell 3 to cell 2. Else, do nothing.
So my input might be (assuming each group of characters is in its own cell):
JOHN SMITH
JOHN DOE SMITH
BARRY JOHNSON
RICHARD P RICKSON
JACK JACK GILES
My output would be:
JOHN SMITH
JOHNDOE SMITH
BARRY JOHNSON
RICHARDP RICKSON
JACKJACK GILES
What's your take on this?
Assuming your data is in columns A, B, and C, this will put the correct output in columns D and E.
In column D:
=IF(ISBLANK(C1),A1,CONCAT(A1,B1))
In column E:
=IF(ISBLANK(C1),B1,C1)

Merge data from two sheets into correct row

I have two excel sheets, with data similar to this:
SHEET 1:
A B C
1 Josh 30 Austin
2 Sam 28 SF
3 Mary 35 Chicago
SHEET 2:
A B
1 Josh Car
2 Mary Truck
3 Sam Van
What I'm attempting to do is merge the two based on Column A. For example, the outcome would be:
A B C D
1 Josh 30 Austin Car
2 Sam 28 SF Van
3 Mary 35 Chicago Truck
I've tried digging through the Excel support on Microsoft's site, but I'm not getting anywhere. Originally I thought it would have something to do with the Data > Consolidate feature, but that doesn't seem to be working.
With the assumption that your names are unique in Sheet2,
On Sheet1 Cell D1 enter:
=Vlookup(a1,Sheet2!a:b,2,0)
And drag it until the end of your data.

How to SUM parts of a column which have same text value in different column in the same row

I have a column with names and a column with numbers:
FirstName Name Number
John Smith 17
John Smith 26
Peter Smith 116
Peter Smith 25
Franck Black 17
Luke Peterson 17
Luke Peterson 37
Names with same FirstName and Name represent the same person. I need to sum the numbers associated with them. I prefer not to use VBA.
A PivotTable might suit, though I am not quite certain of the layout of your data:
The bold numbers (one of each pair of duplicates) need not be shown as the field does not have to be subtotalled eg:
This can be done by using SUMPRODUCT as well. Update the ranges as you see fit
=SUMPRODUCT(($A$2:$A$7=A2)*($B$2:$B$7=B2)*$C$2:$C$7)
A2:A7 = First name range
B2:B7 = Last Name Range
C2:C7 = Numbers Range
This will find all the names with the same first and last name and sum the numbers in your numbers column
If your data has the names grouped as shown then you can use this formula in D2 copied down to get a total against the last entry for each name
=IF((A2=A3)*(B2=B3),"",SUM(C$2:C2)-SUM(D$1:D1))
See screenshot

Excel macro/formula - replace cell values if value does NOT appear in another column

I need help. I have a list of 20 names of certain consultants. I receive a new sheet daily with many names, and if one of them does not match with any of the 20 consultant names, I need to replace the cell value with "X".
E.g.
1. Consultant's list contains John and Mary.
2. Daily list contains 5 names: John, Steve, Dean, Mary and Sue.
3. I now want to replace all the cell which does NOT contain John and Mary with X (thus replace cell with names Steve, Dean and Sue with X)
Help will be appreciated
If your 20-name list is in ColumnA and the daily list in ColumnB each starting in Row1 then in Row 1 and copied down to suit:
=IF(ISERROR(MATCH(B1,A:A,0)),"X",B1)

Resources