Sequence number in excel for non blank rows - excel

How to add sequence numbers in excel, wherein the sequence number starts based on the value of the column B. It should not add the sequence if there is no text in the corresponding row of Column B.
So the row 4 should start with 1 since the column B is having some value.
The example sheet is attached.
Also how can i auto update the sequence if i add new row to it.

In A2, enter the following formula and copy down as required.
=IF(B2="","",MAX($A$1:A1)+1)

In A2
=COUNTA(B$2:B2)
and fill down

Related

1 / 0 Sparse Matrix in Excel

I have a data of 1000 rows and 2 cols. I want to convert it to a matrix of one's and zero's such that the 1st column is Column A, 1st row is Column B and whenever a certain value of A matches B, it returns 1 or 0. I did this for a column but while trying to copy, the formula breaks.
Is there an easy solution for this?
Is there any other easy way to do this in Excel or any other language like Python or R.
Excel Screenshot:
You're almost there. Your formula is almost correct, but the first reference should be C$1. To populate the rest of the matrix, select the full range starting with C2 and enter the formula with Ctrl+Enter.
=(COUNTIF($C$1:INDEX($1:$1,MAX(($1:$1<>"")*(COLUMN($1:$1)))),$B2)>0)*1
Counts if the text in B2 occurs in the indexed first row starting from column 3 to the last non empty column. If only one match is possible, you can narrow it down to
=COUNTIF($C$1:INDEX($1:$1,MAX(($1:$1<>"")*(COLUMN($1:$1)))),$B2)

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.

MS Excel formulae to Concatenate on the basis of string content

How to write the formula for below sample problem statement-
Jack1
Jill1
Mike1
Mike2
Mike3
Dave1
Dave2
Max1
This should be written as-
Jack1
Jill1
Mike1,2,3
Dave1,2
Max1
In order to manipulate data, that data needs to be relatively uniform (the less uniform it is, the more work is required to make it uniform before it can be manipulated.
In this case, I will make the following assumptions about the uniformity of this data:
(1) The number value will always exist;
(2) The number value will always be at the end of each name;
(3) The number value will always be a single digit;
(4) The number value will always start at 1; and
(5) The names will always be in order.
If any of these assumptions is false, then a VBA solution is required. If they are accurate, then a few helper columns will allow for an Excel formula solution.
Assuming your data is in column A, starting at A1, first use this formula in column B, starting at B1 and dragged down:
=right(A1)
This pulls the right-most character from each cell in column A. Then put the following formula in column C, starting at C2 and dragged down [C1 will need to be changed to just "=A1"]:
=IF(B2=1, A2, C1&","&B2)
This will create an arranged list that counts up at each row, until there is a new name. To use this to create a list which only shows the data you want, there are shorter ways but I'll show one of the simpler (but longer) methods:
In D1 and dragged down, put the following formula:
=IF(B2=1,COUNTIF($B$1:B1,1),"")
This will create a column which increases by 1 each time a new name ends its iteration.
Then in column E (or on a new sheet, or wherever you want your final list to be) put this starting in row 1 and drag down:
=IF(ROW()<=MAX(D:D),INDEX(C:C,MATCH(ROW(),D:D,0)),"")
This checks the highest number achieved in column D (ie: the number of names so far), and pulls the index in column C (the formatted name) which matches column D for the current row number. ie: if this formula is in ROW 5, and there are at least 5 names listed from column D, then it will match the number 5 from column D, and pull the info from column C where that row matches.

Search columns and return number of cells containing "5" against colleague name

What I'm looking for is a formula that will do the following: (I'll be using the first row for this example):
Firstly check cells E:J for cells containing a 5.
If all cells contain a 5 it will check the person's name and then add this to the box in column B against the correct name.
If cells E:J have less than 5 in any of these cells it will disregard this row altogether.
To clarify, for Shaun it will count how many rows next to his name have 5's across the board then put the total number of rows fitting this criterion next to his name in Column B.
We can do this with a helper column:
Helper column, keep the name if the count of 5 equals to 5.
Enter below to K2 and fill down.
=IF(COUNTIF(E2:J2,5)=5,D2,"-")
Then we are counting how many times name appears in the helper column. Enter below to B2 and fill down.
=COUNTIF($K$2:$K$11,A2)
Create formula in K2 (output the name if all values are 5)
=IF( AND(E2=5,G2=5,H2=5,I2=5,J2=5), D2, "")
Create the formula at B2which will sum all occurrences of the names
=SUM(IF(K2:K11=A2,1,0))
(and press ctrl+shift+enter)
You maybe will need to replace , with ; (depends on your excel version).

How to convert text to number in Excel?

All examples I see they convert text to number but the content is a number in text format. I need to create numbers for emails so I can use that as a unique id.
What I need is to go from: test#example.com to a unique number.
More detail on pnuts solution.
Column A has your e-mails.
Column B has =row()
C1 has =if(iserror(vlookup(A1,$A$1:B1,2,0)),B1,vlookup(A1,$A$1:B1,2,0))
Drag the formula down.
Column C will contain the row number if the address hasn't been listed above, and the row of the first instance if it has been listed. If your emails don't start in row 1 (such as if you have headers or something), then you'll have to edit all the 1's the the first row of your table with e-mails and place the first formula in that row of column c.
So maybe C3 would have =if(iserror(vlookup(A3,$A$3:B3,2,0)),B1,vlookup(A3,$A$3:B3,2,0))
Write below line in any of the cell in Excel
=VALUE("2.0")
This will return the conversion of text(string) to number. Select Function from MenuBar (I think its in Insert tab) for other functions.

Resources