I have a data table which is a list of items, and each item can be chosen from a drop-down menu.
I want to have a cell that will increment by one for each item that is being added to the list with a specific value.
In somewhat of a coding way:
U2 = FOREACH(Cell in Column C that equals "X") => increment by one;
U3 = FOREACH(Cell in Column C that equals "Y") => increment by one;
Where X and Y can be chosen from a drop-down menu I've created for column C.
Any ideas?
If I'm understanding your problem correctly: C2 = COUNTIF($C$1:C2,C2)+1
This will give you the count of items thus far in the list with the value of C2 plus 1 (I think that's what you mean incremented by 1?).
If I misunderstood and you just want to know that each row is the nth time the item appears in the list then: C2 = COUNTIF($C$1:C2,C2)
Related
Ok I have 2 excel columns
1st column A "Workstream", is a data list with three numbers as a dropdown. 1,2,3
2nd column B "ID", would like to auto-populate based on the selection made from the left adjacent cell + perform a lookup to get the MAX number in the current column and ADD by 1.
For Example:
Workstream
ID
1
W1-001
1
W1-002
1
W1-003
1
W1-004
2
W1-001
1
W1-005
2
W1-002
So when a user selects from the drop-down in column A then Column B auto-populates with something like this
="W"&A:1&"-"
However, in order to complete the value, it needs to do the following:
="W"&A:1&"-" Search for the Max Record in Column B that starts with 1 or whatever value was entered into Column A, then include the next number based on the MAX value selected in Column A
So in the above example, let's say I Enter "2" in column A, then the value that auto-populates in column B would be
| 2 | W2-003
or if I selected 1 from column A given where we left off then the value that would auto-populate in column B would be:
| 1 | W1-006
If I am understanding correctly and you want the format to be "W" followed by number of the workstream (as inferred from the text of your question) try:
="W"&A2&"-"&TEXT(COUNTIF(A$2:A2, B2), "000")
If instead you want the output exactly as shown in the picture you provided, it's even easier:
="W1-"&TEXT(COUNTIF(A$2:A2, B2), "000")
EDIT: You might consider pre-dragging the formula to all the rows that you think have the possibility of being impacted so that you don't have to drag the formula each time you add a row. In that case, try:
=IF(A2="","", "W"&A2&"-"&TEXT(COUNTIF(A$2:A2, B2), "000"))
Here is my spread sheet:
What I'm trying to do is break down my total weight into individual weights, to do this I have to make total weight absolute so I can multiply my % ratios. Only problem is some skus have 6 items some have 5 items so I can't just set every X rows make absolute. essentially I want to do this.
P.S. I have about 5000 rows so it'd take a really long time to manually do it. Wondering if there's any solutions thanks.
You could use nested if functions, it's dirty but it works:
The function goes in J column
Check if the associate H column is empty
If it is empty return empty to keep the spreadsheet clean
If it is not empty check the row above in I column for empty
If it is not empty that the total weight to multiply the ratio by the total weight
If it is empty check the row above that
And repeat as necessary.
I wrote this function that checks 5 deep I think? You could keep nesting it to check 10 deep, 20 deep, etc., until you reach the nested IF limit in excel which I think is 255 so that it adapts to your varying needs in the items list.
=IF(H7<>"",IF(I6<>"",H7*I6,IF(I5<>"",H7*I5,IF(I4<>"",H7*I4,IF(I3<>"",H7*I3,IF(I2<>"",H7*I2))))), "")
Not sure if you just want the J column filled based on the H column, but here's my suggestion. I tend to use hidden columns as they keep my formulae simple but you can incorporate the formula in my G column (the column I'ld hide) into my formula in the F column.
Results Shown
Formulae Shown
P.S. I need reputation as I need to comment on another post.
Sryn
You could use a hidden column with nested If statements, formula goes in Column K:
Check if Column F is blank
If it is not check if the row above is blank
Repeat
Once the row is blank you know you are on the row with the total weight
Set the Column K cell to that value (the I column)
For column J:
If Column K is 0 then return empty
If not multiply Column H by Column K
The formula for Column K is:
=IF(F22 <> "", IF(F21 <> "", IF(F20 <> "", "", I20), I21)) - just add the required amount of nesting, for your case 6 nests is enough
The formula for Column J is:
=IF(K22 = 0, "", K22 * H22)
And then just right click column K and choose to hide that column. Of if you use column K in another part of your sheet just select any unused column.
I am working on a template which records actions of specific companies during an auction. In Column J I have actions, and column K I have the company name. What I need help with is integrating a function to check the validity of a specific action. Essentially You cannot have an action of neg in column J without an action of bid in column J for a specific firm.
So I am trying to use conditional formula to create a check to see if for a given firm in column K is the count of neg less than the count of bids for the same firm in column J
These are the column names, the actions themselves are all in the same clump.
How many actions do you have? If there are not many you could add a column for each action with a count.
For example, add a column called Compare_1 in column L and a column called Compare_2 in column M.
In column L create a countifs formula (I started in Row 3, if your data starts in row 2 you would change K3 to K2)
=COUNTIFS(K:K,K3,J:J,"neg")
You can also modify the formulas to incorporate each type you need to compare in Compare_1 and then do the same in the next column for the Compare_2 data.
=IF(OR(J3="neg",J3="bid"),(COUNTIFS(K:K,K3,J:J,"neg")),IF(OR(J3="dog",J3="puppy"),(COUNTIFS(K:K,K3,J:J,"dog")),0))
and in column M create a countifs formula
=COUNTIFS(K:K,K3,J:J,"bid")
Then create a validation column in column N with the formula
=IF(L3=M3,"Valid","Not Valid").
Again to combine for Compare_2
=IF(OR(J3="neg",J3="bid"),(COUNTIFS(K:K,K3,J:J,"bid")),IF(OR(J3="dog",J3="puppy"),(COUNTIFS(K:K,K3,J:J,"puppy")),0))
There could be an easier 1 step process from someone else, but this is what I came up with.
Searched for this but could not find a way to do it.
I would like to be able to transform a value in one cell to another value in a different cell like this:
When cells in Column A contain Y set same number cells in Column B to Male or when cells in Column A contains N set same number cells in Column B value to Female.
For instance:
A2 = Y then B2 = Male
A2 = N then B2 = Female
=IF(A2="Y","Male",IF(A2="N","Female",""))
by typing yes it wont charge taxes, by typing no it will charge taxes.
=IF(C39="Yes","0",IF(C39="no",PRODUCT(G36*0.0825)))
If you want to do something like the following example, you'd have to use nested ifs.
If percentage is greater than or equal to 93%, then corresponding value in B should be 4 and if the percentage is greater than or equal to 90% and less than 92%, then corresponding value in B to be 3.7, etc.
Here's how you'd do it:
=IF(A2>=93%, 4, IF(A2>=90%, 3.7,IF(A2>=87%,3.3,0)))
I have this issue: here is my table
ColA ColB
te Y
te Y
alo
te Y
te
bb Y
aa Y
I want to count how many records in ColA, which has value "Y" in Col B. and if two duplicate record in A that also have same Y then just count one. (in this case, te record we just count one time)
Many thanks
I am not sure is there is a simple formula to achieve what you want, though it may be possible with an array formula of some kind.
The simplest way in my view would be:
Select your data
Select Data > Filter > Advanced Filter
Check the Unique Records Only checkbox
Select a range you would like to copy the results to in Copy to
Now hit OK
Now use =COUNTIF with criteria =Y to get number of unique records that also have Y
Edit - Array Formula Solution
I did some googling and found a site that shows how to return unique rows using an array formula. See here.
We can use that to return all unique rows in your rows in columns A and B, including rows where column B is blank. (I assume your data is in cell A2:B8)
=SUM(IF(((MATCH(A2:A8&B2:B8,A2:A8&B2:B8,0)) >=(ROW(A2:A8)-(MIN(ROW(A2:A8))-1)))=TRUE,1,0))
Once we know the total number of unique rows, if we subtract from that number the cells in column B that are blank (i.e. not equal to Y) then this should give us the total number of unique rows that have a Y in column B. We can now update the above formula as follows:
=SUM(IF(((MATCH(A2:A8&B2:B8,A2:A8&B2:B8,0)) >=(ROW(A2:A8)-(MIN(ROW(A2:A8))-1)))=TRUE,1,0)) - COUNTIF(B2:B8,"<>Y")
Type this formula in C1 and then press CTRL + SHIFT + ENTER as this is an array formula.
I tested this and it seemed to work ok.