Comparing every odd and even rows in excel - excel

I have a very long column of strings in an excel file. I want to compare every odd and even row together. i.e to compare cells A1 and A2, then A3 and A4, then A5 and A6, etc. I do not want to split it into two separate worksheets, one containing odd number rows and the other one containing even row numbers.
Any help on this, please?

You can use the formula below. You start at row 2. Check if it is an even row then compare it with the above odd row
=IF(MOD(ROW(), 2)=0,A1=A2,"")
Update as requirement from comments, firstly, you have to insert the blank row for the formula to get value B1:
=IF(MOD(ROW(), 2)=0,A2=A3,B1)

Related

Excel: An array in an array?

So, I would like to return the contents of all rows where the value in column A is, let's say, 1.
My thought process is that I could use:
=INDEX(row_range,MATCH(1,A:A,0),0))
But Match will only return one value here, i.e. the number of the first row which contains a 1 in column A.
Is there a way of creating an array with the Match formula (thus returning the multiple row numbers, all of which contain '1' in column A) and then place that in the Index array so that it then runs through each of the Match-array values and creates a big long list of values in one array which I can then list out on a separate sheet?
Hope this makes sense...
Here is a demonstration of what I'm hoping for, if that helps! The idea would be that the array as shown would be created, which could then be extended down the column as per the part underneath.
https://i.stack.imgur.com/nCusM.png
Use the file you showed in your example (as "Sheet1") and put these formulas into indicated cells in Sheet2:
Into cell A2 put
=AGGREGATE(15;6;ROW(Sheet1!A:A)/((Sheet1!A:A=1)*1);ROW(A1))
this will give you all the rownumbers where value in A column of sheet1 equals 1.
Into cell B2 put
=COUNTA(INDIRECT("Sheet1!"&A2&":"&A2))-1
this will give you how many cells are filled in that row.
Into cell C2 put
=TEXTJOIN(",";TRUE;OFFSET(Sheet1!$A$1;A2-1;1;1;B2))
This will give you all the cells with data from that row concatenated. If you dont have this formula (first time in 2016 I believe) you can use OFFSET function to list the values in separate columns and then CONCATENATE them.
Copy these three down as many times as you want and into cell C1 put
=TEXTJOIN(",";TRUE;OFFSET(C2;0;0;COUNTIF(Sheet1!A:A;1);1))

How to create a sum formula if the number of rows vary?

I am curious how to create a sum formula in excel if the number of rows varies. For example, if I have a worksheet with a header in A1. This worksheet also has 100 values under it. If I want to sum all of the rows, I would use =sum(A2:A100). However, lets say then a few more numbers are added, I rather would not re-enter the formula to account for the added values. I tried using =sum(A2:A) but that does not return a value for me.
from comments (sic)
So the header is actually in A3. I tried =sum(A:A)-A1-A1-A3 but that did not work
With your header in A3 and the first summable number in A4,
=sum(a4:index(a:a, max(4, match(1e99, a:a)))

How to refer to multiple adjacent cells

I have a work sheet in which there are several cells with a specific entry - let's say "A". These are not all in the same rows/columns. After each cell is a date.
I need to count the number of cells containing "A" which also have a specific date in the cell immediately to its right. I've tried combinations of Countifs and Indirect, with no success. How can I achieve this?
This counts the number of times that there is A in column A and 1 in column B
=SUMPRODUCT(($A$1:$A$5="A")*($B$1:$B$5=1))
This outputs in cell D1
Not too difficult.
I have created a sample sheet with 8 rows and 5 columns of data.
See below, the formula in cell C12 counts the number of occurrences where the a cell with a date of October 31, 2017 is directly to the right of a cell that contains the text A.
If you want more info as to how this works, read on:
When searching for cells that contain A, you don't search in the last column of the data (in this case, column E) because it is impossible for a column to the right to have any date in it. This is why a portion of the formula says A1:D8="A" instead of A1:E8="A". This is the same reasoning why we start searching for a date in column B rather than column A in the formula.
You can achieve this with a helper row. Add additional row on top of your Worksheet. In cell "A1" enter formula below.
=COUNTIFS(A2:A2000,"A",B2:B2000,"YourDate")
Drag this formula to the rightmost of where you have data, then simply sum all values returned by formula.

Excel get cells value if cells contain specific text

I have Table 1 & 2 like image.
How i can get all cells value if ID is equals?
If you just need to add numbers, there are formulas for this, but I'm not sure if there's a single formula for adding string values as in the provided example. One way to resolve this is by using accumulator columns as in this screen shot:
The formula in cell C3 is:
=IF($A3<>C$1,C2,IF(C2=0,$B3,C2&", "&$B3))
Copy this down to cell E10 (or wherever that table needs to end) and columns C to E will accumulate the values from column B. Table 2 then just maps the first and last rows of the accumulator columns. The zeros in cells C2 to E2 is a work-around to prevent Excel from converting blank cells into zeros.
Hope this helps!

Excel - count multiple words per cell in a range of cells

I have some cells with multiple names in them as so:
Names are not repeated in the same cell.
I have some more cells below where I need to count how many times each name appears in each column. The names of the people counted above are to the right in one column, and the number of times each name appears should be calculated in the corresponding row of the next column.
For example, the cells that read 2 and 0 should read 4 and 4 (for the amount of times they appear in the previous image).
Here is an example of the desired result:
What formula should I use to accomplish this?
You can use an array formula (Ctrl+Shift+Enter) for this. Set up your list of names somwhere (For example, F1, F2, F3 ...) then next to it (in G1):
{=COUNT(IFERROR(FIND(F1,A:A,1),FALSE))}
Assuming A is you names column. Than simply drag G1 down to copy for all names.

Resources