Combining Data from two columns in excel, alternate rows - excel-formula

I have two columns A and B
**A**
30
40
50
60
70
**B**
90
80
10
20
I am struggling to find a formula that will allow me to combine the two columns by taking first value of column A followed by two values of column B and so on:
Combined Column "C" Example:
**C**
30
90
80
40
10
20
and so on.
What can I do? Thanks

If your data starts from row 1, you can type the following formula in column C:
=IF(MOD(ROW(),3)=1,INDIRECT("A"&TEXT(ROUNDUP(ROW()/3,0),"0")),IF(MOD(ROW(),3)=2,INDIRECT("B"&TEXT(ROUNDUP(ROW()/3,0)*2-1,"0")),INDIRECT("B"&TEXT(ROUNDUP(ROW()/3,0)*2,"0"))))
If the data starts from row 2, then the formula is:
=IF(MOD(ROW(),3)=2,INDIRECT("A"&TEXT(ROUNDUP(ROW()/3,0)+1,"0")),IF(MOD(ROW(),3)=0,INDIRECT("B"&TEXT(ROUNDUP(ROW()/3,0)*2,"0")),INDIRECT("B"&TEXT(ROUNDUP(ROW()/3,0)*2-1,"0"))))

Related

How to write a multiple criteria index-match that averages all occurrences of results

I am trying to find the average of all occurrences in column C based on an index-match search of column A and B.
Here is the example data:
A B C
1 10 85
1 10 80
2 20 83
2 20 75
Currently, my function is this
=AVERAGE(INDEX(C2:C5,MATCH(1&10,A2:A5&B2:B5,0)))
This produces the value 85. I would like to take the average of both 85 and 80.
Thank you!
Looks like typically a case for AVERAGEIFS(), average a specific column with certain criteria in other columns e.g. your 1 in column A and 10 in column B.
So try:
=AVERAGEIFS(C1:C5,A1:A5,1,B1:B5,10)

How to I find where a certain number would fit in a row of values in Excel?

I have an array of 10 numbers in numerical order ranging from 1-100 in Excel Column B-K. In column A, I have a single number from 1-100. I want to find out where the value in column A would fit in the values from B-K.
For example, for the following 10 numbers (in descending order), the value 58 would fit in the 4th position (between 60 and 54). How would I write a formula to do this for many different values?
80 75 60 54 32 21 20 15 12 5

Excel - Remove duplicates and SUM at the same time

I have a column with ID's, but they are duplicated; for instance:
"0,0,1,1,1,2,3,3,4,4, ... "
For each row, I have a given value in the other columns, for instance:
"0-24; 0-36; 1-13; 1-34; 1-23;..."
I want to keep only one row with each ID but I need to sum the values of each ID, that is, sum all the values in all columns for a given ID (0,1,2,...), which may include several rows.
Is there a easy way to do this using Excel?
Here is some sample data (table to the left) together with the desired output (tables to the right).
ID Value ID Value
0 24 0 60
0 36 1 70
1 13 2 16
1 34 3 24
1 23 4 48
2 16
3 9
3 15
4 24
4 24
What you can do is to copy your IDs and paste them for example in another Sheet. Let's assume your original table is in Sheet1, and you copy all your IDs to column A in Sheet2.
Then you remove duplicate IDs in Sheet2:
Select column A > Data Ribbon > Data Tools > Remove Duplicates
In column B, you then put the formula:
=SUMIF(Sheet1!$A:$A, Sheet2!$A2, Sheet1!$B:$B)
Note: above formula goes into cell B2 on Sheet2, and you copy it down with pasteSpecial > only formulas.
Edit: if you still want the same number of rows etc because of the information in your other columns, just skip the "Remove duplicates"-part.

Index & Match formula using IF and ISERROR

I have data in columns C & D. A range of ten students in A1 to A10 are identified with roll numbers. In Column C and corresponding Column D, there are 8 students from roll number 1 to 8 (Column C) and their marks (Column D).
I need a formula in column B to automatically extract the marks from column D against the roll numbers in Column A and the two cells in column B (marks of roll number 9 & 10) may remain blank.
Any Excel formula or VBA macro solution is much appreciated.
Column-A Column-B Column-C Column-D
1 50 1 50
2 55 2 55
3 35 3 35
4 60 4 60
5 78 5 78
6 45 6 45
7 39 7 39
8 82 8 82
9
10
Try using VLOOKUP with IFERROR, i.e. this formula in B2 copied down
=IFERROR(VLOOKUP(A2,C$2:D$9,2,0),"")
VLOOKUP will return the required marks when the roll number exists.....or an error which IFERRORconverts to a blank.
The simplest solution would seem to be copy and paste. Alternative solutions would seem to be relatively simple (eg #barry's) but if you really want INDEX, MATCH, IF and ISERROR then maybe:
=IF(ISERROR(INDEX(D:D,MATCH(A2,C:C,0))),"",INDEX(D:D,MATCH(A2,C:C,0)))

Take the group average

I've two columns: A and B; for each 3 rows in A column, I want to take the average of that 3 rows and write to B. here is the example:
A B
10 20
20 50
30
40
50
60
I need the excel formula of this calculation. Thanks in advance
Suppose your data in column A are in range A1:A100, then use following formula, say in B1:
=AVERAGE(INDEX($A$1:$A$100,3*(ROW()-ROW($B$1))+1):INDEX($A$1:$A$100,3*(ROW()-ROW($B$1)+1)))
and drag it down

Resources