Is there a way to get auto-numbering in column "B" of the form given in the pattern below without VBA? (Densities of "A" and "B" are arbitrary; the only rule is that it cannon be two and more A's 'in a row', and "A" always goes first.)
A
B 1
B 2
B 3
A
B 1
B 2
A
B 1
B 2
B 3
Some auxiliary calculations (columns) if needed are fine.
P.S. The extension of the task is here.
Hi Garej: Based on the example you provided you could accomplish this with an "IF-THEN" formula in excel. Just put your letters in a blank excel document, paste the formula in cell B2, and you should be good. You need hardcode ="A" in the formula to be whatever "A" is. Here is the formula:
=IF(A2="A","",IF(A2=A1,B1+1,1))
If you don't want to hard code the ="A", you could also change the beginning from:
A2="A"
to
A2=$A$1
which would allow you to have a dynamic value instead of "A" so the full code would be....
=IF(A2=$A$1,"",IF(A2=A1,B1+1,1))
The logic behind this code is as follows:
Look at the letter in the current row...
IF the letter in the current row is "A" [or matches the contents of $a$1], then leave the number blank.
IF the letter in the current row is the same as the letter in the previous row, then add one to the number in the row above.
IF the letter in the current row is different than the row above [and is not "A" or $A$1], then start over at 1.
Put the following starting in cell B2 (B1 can be hardcoded as 1):
=IF(A2="A","",if(A1="A",1,B1+1))
This simply looks at the prior row - if Column A in the prior row said "A", then we know that this current row is a new one starting at 1. If it wasn't "A" in the row above, we know this is a continuation of the current count. It first checks the current row - if the current row is "A", we know we want this one to be blank.
Related
I have 2 worksheets, SheetA & SheetB I'm checking cells to ensure there is no duplication within column B and that the value entered starts with a letter. The following formula works fine when applied to a cell in column B on either sheet.
=AND(CODE(LEFT(B10,1))>=56,CODE(LEFT(B10,1))<=122,COUNTIF($B:$B,B10)=1)
I get a warning if the cell matches a value anywhere in column B or if the first character is a not letter.
I want to expand this so the duplication check looks at column B on worksheets A & B.
I've changed the formula to
=AND(CODE(LEFT(B10,1))>=56,CODE(LEFT(B10,1))<=122,COUNTIF(SheetA!$B:$B,B10,SheetB!$B:$B,B10)=1)
But that throws an error and I'm not sure how to proceed.
Can anyone advice how to write a formula that can be applied to all cells in column B on workseets A & B that checks for duplication across these two columns and ensures the value starts with a letter.
Thanks
Give a try on below formula-
=AND(CODE(LEFT(B10,1))>=56,CODE(LEFT(B10,1))<=122,COUNTIF(SheetA!$B:$B,B10)+COUNTIF(SheetB!$B:$B,B10)=1)
I'm creating a list, and wish to link items in that list...
Here's a hypothetical setup to relay the basic issue:
column B is merely a list of successive numbers (1 through 1000)
column K receives a value of "O" or "C" depending on whether the issue is open or closed
column L receives a numerical value that references the value of column B in another row.
I want column L to link one row to another.
ex:
Value of B1 is "1" --->we'll call this "row 1"
Value of B2 is "2" --->we'll call this "row 2"
If L2 is "1", I want row 2 to be linked to row 1.
Then, if K1 is "O", I want no action to be applied to row 2.
However, if K1 is "C", I want row 2 to be highlighted.
Essentially, we're creating finish to start links for tasks.
Therefore, this should be able to have several rows with column L values all referencing the same column B value, so when that row is changed to closed/"C", those several other rows all become highlighted.
I've been digging for a while, so sincerely appreciate the help.
You may try something like this...
Highlight the whole columns say B:L and make a New Rule for conditional formatting using the formula given below and set the format as per your choice.
=INDEX($K:$K,MATCH($L1,$B:$B,0))="C"
See if this is what you are trying to achieve.
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
let's say I have a list of duplicate values in a column such as:AAABBAACABC. ...AAC. Then I want Excel to Rank respectively the first A as A1,the first B as B1 the second A as A2 and the second B as B2 and so forth until the A(nth) and the B(nth). And any additional A should automatically Rank as A(nth+1). Same thing for B C etc.
note that I should be able to enter any new value such as X that will automatically Rank as X(nth+1) or X1 if it did not exist in the table before.
Hoping that I made myself understood. I am waiting for anyone to help me. VBA or array formulas I have no preference once I can realise what I want.
Note that I found a way by sorting them in accending order but it can't match for any additional value at the end of the data base.
Thanks.
I am assuming your data is in Column "A". Enter the formula in Column "B" and copy the formula till the row you want.
=A1 & IF(A1="","",COUNTIF($A$1:A1,A1))
I don't even know if this is possible in Excel or not. I'm needing a way to link subsequent rows with previous rows (children to a parent).
For example, Row 2 contains the parent information as denoted by an 'M' in column E.
If the parent has 3 children, rows 3,4,5, they're going to contain an 'S' or 'D' in column E.
If there's an 'S' or 'D' I need to fine the last row searching up that has an 'M' and then grab the value from the B column in that row (which is a unique ID for the parent) and insert it into a column in rows 3,4 & 5 to create a relationship between the 3 children and the one parent. There will be cases where there are no children to any number of children, and so far we've been assured that the next row "up" will always be the parent for the subsequent children rows.
So in the above, because E3 and E4 are D (daughter) of Row 2, I need to take the B2 (UID) and put it in F3 and F4. Since the next row is an M (parent) F5 is blank. Row 6 is the child of row 5, so get B5 and copy it to F6.
Column B is a formula of first 3 letters of first name and dob formatted to YYYYMMDD and isn't necessary (but will be stored) for child rows. Hope that clarifies!
Here is a solution that seems to work: the following formula would be written in E4 (entered as an array formula, i.e. ctrl-shift-enter on PC or cmd-shift-enter on Mac), then copied down as needed. It requires there to be sufficient space above it (because you look "up to three above this row", that needs to be a valid row).
=IF(NOT(E4="M"),INDEX(B$1:B3,MAX((E1:E3="M")*ROW(E1:E3)))," ")
Explanation:
=IF(NOT(E4="M") - check that this is not a "parent" (i.e. we need to do a lookup)
MAX((E1:E3="M")*ROW(E1:E3))) - see what cell has an M. the (E1:E3) produces 0 or 1
- multiply by the row number and you get an array of 0 or row number
- the MAX of this is the last row number with an M
INDEX(B$1:B3, number) - find the corresponding value in column B
- note the $ sign since the ROW is absolute row
" " - empty space when there IF is false (i.e. this is a parent)
Here is how it looked for me:
There may be a simpler way but...
=IF(F12="",IF(E13<>"M",B12,""),IF(E13="M","",F12))
looks to work.
I tend to solve this sort of situation with an extra column. Column B has your ID, and Column E has the classification. Let's say Column I (which can be hidden if the display is unhelpful) has the ID of the most recent parent. Assume we are starting at Row 2 (you'll see why in a moment). If E2 has "M", then we want the ID (B2); if it doesn't, we want to propagate the value from the previous row. This is the formula which does that:
=IF(E2="M", B2, I1)
Then in Column F, your "Link To" column, use this formula:
=IF(E2="M", "", I2)
Fill down, and that's all you need.
Updated to match newly posted image
Using your provided sample data, use this formula in cell F2 and copy down:
=IF(E2="M","",LOOKUP(2,1/(E$2:E2="M"),B$2:B2))