My source table looks like this:
A1 12
A2 13
B1 14
B2 15
B3 16
I want it in a format like below:
1 2 3
A 12 13
B 14 15 16
Since there is large amount of data, it can't be done manually.
Please let me know how to do this?
I can't quite see how you want it formatted as the question isn't formatted.
However, you can use a feature in Excel called Text to Columns, on the Data tab.
This allows you to split text in a single column into multiple columns. You can specify the delimiter (the character to divide the columns), which may be a space or tab in your case.
Create a third column with formula =LEFT(A1, 1). Then a fourth column with =MID(A1,2,100). Insert a new Row 1 and give each column a name. Finally, insert a Pivot Table with column 3 as the row headers and column 4 as the column headers.
Another option might be to combine elements of the two existing answers. Insert a new ColumnB, split ColumnA with Text to Columns, Fixed width (one character), add labels (say a, b and c) to the columns then pivot with a for ROWS, b for COLUMNS and c for VALUES.
Related
I have a table that looks like this:
Type Value
Movie 5
Food 3
Gas 10
Food 2
.... ....
And There's a second table I want to fill in with "Value" based on their type in the first table, so that the corresponding rows look like this:
Rent Food Movie Gas Clothing ... ( appear in specific order bc they are subcategories)
5
3
10
2
The title row is already there, so I was thinking there might be some kind of lookup method to do this? How do I do that?
your second table apperas to hold one value per row but it doesn't have a label. it does correlate to the original row number, is this by design or coincidence?
if this is by design then you can use those 2 columns, hide them if you like, get a unique list of categories by copying you r abels to a new colum, removing duplicates in the data tab, then paste special transpose in c1 to create colum headers.
so column a and b remain unchanged
row 1 contains header starting at column c
your data starts at c2
this is the formula
=Iferror(vlookup(C$1,$A2:$B2,2,false),"")
drag it down and to the right
you can copy paste special values when done to remove the formulas
for something with only a hundred or thousand cells this will be one of the easier options but i would not do this on large tables, for those i would use power query or VBA
Assuming your 1st table is in Sheet1 and 2nd table is in sheet2.. you may try to fill in Sheet2!A2
=IF(Sheet1!$A2=A$1,Sheet1!$B2,"")
and drag it all the way.. Hope you get how it works.. and what you need.
I have data in an excel spreadsheet. It is arranged as follows: 6 rows with 15 columns. Then a 7th row with 8 columns. Then 6 rows with 15 columns and a 7th row with 8 columns. This repeats down the spreadsheet. There are 441 'blocks' of this pattern.
There are two options that I have for this data.
Option 1: I would like it to be in a single column, so the values from the first row are now the first 15 values in column 1, then the values from the second row are now the next 15 values in column 1, and so on.
Option 2: I would like the values to be formatted in a grid that is 98 columns ad 441 rows. The data from the first 'block' would be the first row. the data from the second 'block' would be the second row.
Is there any way that this can be done?
Option 1 is possible with unpivoting. Assuming your data starts in A1, insert a new row at the top and a new column at the left and apply the steps detailed here. From the Table delete the left-hand two columns and filter the remaining column to delete blank rows.
For Option 2 consider OFFSET.
I'm a total Excel nub and can't find the answer I'm looking for. Must be easy peasy, but since I'm not into Excel I also don't know what to look for. Sorry if I'm having my question wrong.
I have output in Excel like this:
A 1
A 2
A 3
A 4
B 1
B 2
B 3
B 4
B 5
B 6
and I want it like this:
A 1 2 3 4
B 1 2 3 4 5 6
this question is quite complex in a way.
let me explain it more in detail:
as you see above, we have two columns A and B, you have text strings in column A , these text strings could be repeated. As you see in the example, there are 4 As, 5 Bs, 3 Cs 1 D and 3 Es. In column B each one of these strings have different corresponding values. For example, text strings B in column A has five corresponding values in column B, namely 11, 12, 13, 14, 15, and 16.
Now we want a list of UNIQUE values from column A, and lets say, we put this list in column C and then for each of these unique values in column C we want to list their corresponding cells in column B and put them HORIZONTALLY in front of each of these unique text strings in column C.
For this you need two kinds of formulas:
Formula 1 to calculate the list of the unique values in column A :
this goes in C2:(leave C1 empty)
=IFERROR(INDEX($A$1:$A$999;MATCH(0;FREQUENCY(IF(EXACT($A$1:$A$999;TRANSPOSE($C$1:C1));MATCH(ROW($A$1:$A$999);ROW($A$1:$A$999)); ""); MATCH(ROW($A$1:$A$999);ROW($A$1:$A$999))); 0)); "")
this is an array formula, so press ctrl+shift+enter to calculate the formula, and drag and fill down as many as you want in column C.
*Formula 2 to find and list horizontally the values from column B *
=IFERROR(INDEX($B$1:$B$999;SMALL(IF($C2=$A$1:$A$999;ROW($A$1:$A$999)-ROW($A$1)+1);COLUMN(A$1)));"")
this is an array formula, so press ctrl+shift+enter to calculate the formula, put this in D2 and drag and fill down until the last cell of column C. then select D2 to D6 and drag and fill horizontally. You should get all of the corresponding cells in front of each unique item.
P.S. adjust the formulas to meet your regional settings by replacing ; with , I suppose.
Finally here is the link to an example sheet downloadable from here .
This is very generic but hopefully will help.
Highlight the cells that you want to transpose to.
Type the equation..."=TRANSPOSE(B1:B4)" (edit as necessary).
While the cells are still highlighted, press "ctrl+shift+enter". (brackets should appear around the equation)
Finish editing the cells.
Celebrate
I need to collect Sch Code from different columns into one column as shown below.
First priority is by formula or UDF Function if possible.
My Data:
Column A Column B Column C Column D Column E Column F Column G
SCH Code Value SCH Code Value Rating SCH Code Value
C01-3-1 4 C01-4-1 8 300 C02-3-1 8
300 C02-3-5 9
C01-3-2 5 C01-4-2 12 300 C02-3-2 12
C01-3-3 6 C01-4-3 21 300 C02-3-3 21
300 C02-3-6 10
C01-3-4 7 C01-4-4 4 300 C02-3-4 4
Required Result (Only Sch Code required in summary sheet but it is required by formula or VBA UDF function) :
Column A
C01-3-1
C01-3-2
C01-3-3
C01-3-4
C01-4-1
C01-4-2
C01-4-3
C01-4-4
C02-3-1
C02-3-5
C02-3-2
C02-3-3
C02-3-6
C02-3-4
You can collect unique non-blank values from column A with an array formula e.g. =INDEX($A$2:$A$99,MATCH(0, IF(LEN($A$2:$A$99),COUNTIF(I$1:I1,$A$2:$A$99),1),0)). Since this returns #N/A where it has no more values to return from its column, you can pass control over to a similar formula that references another column with IFERROR.
To choose from your three columns of SCH Codes, you would need to stack this 3 deep. The formula in I2 is:
=IF(LEN(I1),IFERROR(INDEX($A$2:$A$99,MATCH(0, IF(LEN($A$2:$A$99),COUNTIF(I$1:I1,$A$2:$A$99),1),0)),IFERROR(INDEX($C$2:$C$99,MATCH(0, IF(LEN($C$2:$C$99),COUNTIF(I$1:I1,$C$2:$C$99),1),0)),IFERROR(INDEX($F$2:$F$99,MATCH(0, IF(LEN($F$2:$F$99),COUNTIF(I$1:I1,$F$2:$F$99),1),0)),""))),"")
This array formula requires Ctrl+Shift+Enter, not just Enter. Once entered correctly, it can be filled down to catch all possible values. I would fill down for at least three times as many rows as you have in order that the blanks would have a place if they were filled in at a later date.
In theory, you could stack this much deeper but for practical purposes, I wouldn't go much deeper than this. Array formulas eat up calculation resources at a logarithmic rate so the size of your data is going to be a key factor on whether this is a suitable solution.
One solution:
Copy and paste all values in column C below column A data. Highlight column A and go to Data>Remove duplicates then Data>Sort.
Given a column like this:
Column A
1 4
2 Blank
3 Blank
4 3
5 blank
6 2NDF
7 Blank
8 blank
9 1/2/2014 <-- Date value I need to change to a text value: "1-2"
10 blank
11 5/1/2014 <-- Date value I need to change to a text value: "5-1"
12 blank
...
I need to find a way to programmatically change each cell that contains a date value like in rows 9 and 11 into a text value the equivalent of the numeric month followed by a dash follwed by a numeric day. I have 24,000 rows. Doing a find and replace is not practical. I cannot change the format of the entire column because rows like 1 and 4 get converted and I don't want those to get converted.
Create a new column B and use the function
=IF(NOT(ISERROR(DATEVALUE(A1))),MONTH(DATEVALUE(A1))&"-"&DAY(DATEVALUE(A1)),A1)
OK, I achieved the result I wanted by splitting out three "if" tests (similar to what Brett suggested) into 3 additional columns. Each column had its separate "if" test and built on the column before it. Here are the if tests:
=IF(N5>40000,MONTH(N5)&"-"&DAY(N5),N5) # sets format I want and skip cells that are low integers and not dates
=IF(O5=0,"",O5) # Sets cells with "0" in them to blank
=IF(ISERROR(P5),N5,P5) # fixes cells that were originally text and that produced errors
Given that in the OP the data seems to be in ColumnA starting in Row1 a single formula such as:
=IF(OR(A1<40000,ISTEXT(A1)),A1,MONTH(A1)&"-"&DAY(A1))
and copied down would seem adequate.