How to change column to header in excel? - excel

a1 | b1 | 0.1
a1 | b2 | 0.2
a2 | b1 | 0.3
a2 | b2 | 0.4
how to transform this table to
xx | a1 | a2
b1 | 0.1 | 0.3
b2 | 0.2 | 0.4

Make use of Pivot tables. Enter Column A as Column labels, Column B as Row Labels and Column C as Values. If values are not sum by default, change it to Sum.
Output:
You can remove the headers deselecting the Field Headers in Options tab.
You can also hide the grand totals by clicking on Options under the same tab. (Located at the left corner of the screen).

If you don't want Grand Total and other..., you can use Index:
Create a New Sheet with your Header xx, a1, a2
Copy column B b1, b2,...to the new sheet under xx
select the Data b1, b2,... in the new sheet
Remove Duplicates
Distinct and unique values will remain
Under a1 write the following formula:
=IFERROR(INDEX(Sheet1!$C$1:$C$4,MATCH(B$1&$A2,Sheet1!$A$1:$A$4&Sheet1!$B$1:$B$4,0)),"")
Array Formula press Ctrl+Shift+Enter at the same time instead of Enter
and drag it in the same row and down in columns
Change A1:A4, B1:B4 and C1:C4 to correspond your last row of Data but keep $ for fixed references

Related

Increment row reference based on index in selection, and not same row number between sheets

I have a workbook containing two sheets. Sheet 1 has values in column A for every row up to row number 2000. Sheet 2 should duplicate the values over multiple rows for each row in Sheet 1. Like this:
Sheet1:
a1 | 123
a2 | 456
a3 | 789
and for Sheet2:
Sheet2:
a1 | 123
a2 | 123
a3 | 456
a4 | 456
a5 | 789
a6 | 789
The duplication is fairly simple, where I just put a reference of the next rows to the row collecting the row value from Sheet1:
a2: =a1
However, selecting and dragging rows a1 and a2 in Sheet2 to get the corresponding formulas copied over to the next rows, the formula does not reference the correct rows in Sheet1. Something like this occurs:
Sheet2:
a1 | 123
a2 | 123
a3 | 789
a4 | 789
Where cell a3 in Sheet2 references cell a3 in Sheet1, instead of cell a2 which is the next row. I have tried several functions with index, offset etc. but none of them seem to circumvent the automatic same-row-reference between the worksheets. Any quick ideas?
"generic approach" imho is either one of these.. :
Just edit the "2" in the 1st comment ans.
use ROW() and argument for OFFSET()
'Manually' build the reference using INDIRECT
set the 1st 2 row manually, 3rd row onward use =IF(A2=A1,INDIRECT("Sheet1!A"&(row()+1)/2,TRUE),A2) and drag downwards.
Is this what you are looking for?

Is there a formula in excel to find if a two letters cell in row1 exist in row2 and 3?

I have a sheet in excel with three rows and three columns. I am looking for a formula in excel to find if the letters in first row exists in two other rows (each cell has two letters). For example this is my data:
A | B | C
------+----+---
1. MN | MM | HO
2. NN | KM | JJ
3. LM | MM | KO
I want to have a formula to return number of cells that are not match for each row, in column D and highlight the cells in row 2 and/or three that not exists in row one.
For example in my data: The string in C1 is HO and we have O in C3 but we don't have H in C2. But for two other columns (A & B), one letter of row A1 (MN) is in row A2 (NN) and the other one in A3 (LM), so row 2 column C should highlighted in red and number of mismatch should be 1 in row2 column D.
Comparisons are made individually in each column and the sum of the cells that highlighted in red is written in column D of the corresponding row.
Any help would be greatly appreciated
Thanks in advance for your help.

Sum fields in a column if there is an entry in a corresponding row in another column

Assume the following data:
| A B C
--+------------------------
1 | 2 3 5
2 | 2 3
3 | 4 4
4 | 2 3
5 | 5 6
In cell A6, I want Excel to add cells C1, C2, C3 on the basis that A1, A2 and A3 have data in. Similarly, I want B6 to add together C1, C4 and C5 because B1, B4 and B5 have data.
Can someone help?
In A6 enter:
=SUMPRODUCT(($C1:$C5)*(A1:A5<>""))
and then copy to B6:
A simple SUMIF formula will work
=SUMIF(A$1:A$5,"<>",$C$1:$C$5)
Place that formula is cell A6 and then copy it to B6.
You can create another column, e.g. AValue, with the formula =IF(ISBLANK(A1),0,A1) in it. This will return 0 if the cell in A in the corresponding line is empty, or the value from the cell in A otherwise.
Then you can just sum up the values of the new column.

copy cell to selected date range

I have a list of dates in B2:GF2. I enter 2 dates - "A1 start date and B1 End date". I also enter a value (number) in cell C1. The value in C1 should be copied to all the cells under the list of dates from A2:GF2 between the dates choosed in A1 and B1. Let the copied value between the row A3:GF3.
E.g.:
A | B | C
Row1 3/3/2015| 5/5/2015 | ABC
Row2 2/2/2015 | 3/3/2015 | 4/4/2015 | 4/23/2015 | 5/5/2015....
ABC ABC ABC ABC
In cell C4, type =IF(AND(C3>=$A$2,C3<$B$2),$C$2,""), then just copy cell C4 across.

If column B cell value contains A cell value

I have two columns A and B in excel and I want third column output to be like show below
A B C
-------------------
a | sd | a.com
d | a.com |
f | g.in |
g | ad | g.in
B column has 'a.com'which contains 'a.' so C column it displays a.com
.B column doesnt have which contains 'd.' so column cell is empty and so on..
Put the following formula in column C:
=IFERROR(INDEX($B$1:$B$4,MATCH(A1,LEFT($B$1:$B$4,SEARCH(".",$B$1:$B$4)-1),0)),"")
It is an array formula, so press Ctrl-Shift-Enter instead of Enter when entering it.
Try this formula in C1 copied down
=IFERROR(VLOOKUP(A1&".*",B$1:B$4,1,0),"")
IFERROR function only works in Excel 2007 or later - for earlier excel versions try
=LOOKUP("zzz",IF({1,0},"",VLOOKUP(A1&".*",B$1:B$4,1,0)))

Resources