All, I am trying to randomly assign groups (column F) based on "Count" and "Group" column (B and A) and been having some trouble finding the right formula and would appreciate some pointers.
Screenshot below shows, a sample output in column F. Here, you may see Group A is assigned 4 times and B is assigned 6 times randomly
Try this in F2 and drag down:
IF(AND(RAND()<0.5,COUNTIF($F$1:F1,$A$2)<$B$2),$A$2,IF(COUNTIF($F$1:F1,$A$3)>=$B$3,$A$2,$A$3))
Related
I'm currently working on Excel.
I have two columns (Column A and COlumn B). Column A contains a list of jobs(one job per cell), while column B contains the cost of each job per hour.
I'm trying to find a formula that tests if a given text or word (for example "Accountant") is contained in one of the cells in Column A, and then returns the corresponding value from Column B (next to it).
Thanks in advance for your help!
The answer is =VLOOKUP("ACCOUNTANT";[RANGE COLUMN A AND B];2;FALSO)
I have a very difficult Spreadsheet that I need to figure out a formula to get an answer. The Spreadsheet can have multiple rows (each row is a policy) In the rows there are several columns (A, B, C, D , E, F, G) Columns D, E, and F can have one of 4 answers (Right, Left, Up, or Down).
I want to create a formula that tells me how may policies (rows) have and answer of up or down in any one of the 3 Columns (D, E, or F). If it appears in multiple column I only want to count it once. Can anyone help with this formula?
I have been trying to use =SUMPRODUCT as The rows may be filtered by a column that has a name. Example: filtered on Paul (column A) to see a count of the number of policies that Paul worked on that have up or down in either of the three columns. I want to receive the total number of policies not the number of up or downs.
Thanks in advance for any help you can provide.
If we can do it in multiple steps here's one approach
define range for Up, down
enter formula =sumproduct(--RNG=D4:F5))>0 in H2 and fill down
enter formula =Countif(H2:H6,"=True") in bottom of H which denotes unique policies having up or down in cells D:F. (assuming each record is a unique policy)
I am trying to assemble a index/match combination and am having trouble figuring out how to make it work. I have experience with a lot of the formula types in excel, but unfortunately I am pretty ignorant when it comes to these functions.
I will explain what I am trying to do first, but I have attached 3 images at the end that will probably make things more clear.
In order to identify the specific values I want, I am having to use helper cells. These helper cells are denoted with the (helper) tag in the pictures. These cells go through and grab the adjusted closing price of the stock (column A) at the beginning (column C) and the end (Column D) of a dynamically calculated period.
I would like to consolidate these values into numerical order in columns F and G. The thought is that the first non zero number in C/D is belongs to the first predefined period and should go into columns F/G beside the #1 (column E). This gets carried on through all of the periods (ex: 2nd non zero goes beside the number 2, third nonzero number goes beside the number 3 etc.)
This is just an example of one stock. I need the function or formula to be dynamic enough to work on a wide variety of distributions. Sometimes there are up to 100 dynamically calculated periods within the stock analysis.
Below are the images that should provide more clarity
Image 1 is an example of what the data looks like
Image 2 is a crudely drawn example of how I would like the data to move
Image 3 is the desired result
Image 1
Image 2
Image 3
Updated image for Scott Craner showing out of order results
Please let me know if I can clarify any confusion.
If you just need to return the first value of each period (column C) and the last value of each period (column D), you could use index match and lookup to do this without even using helper columns.
Try this in cell F2
=INDEX(A2:A50,MATCH(E2,B2:B50,0))
And this in cell G2
=LOOKUP(E2,B2:B50,A2:A50)
Depending on much variance is in your overall number of rows, you could use indirect references in the formulas to dynamically update the ranges.
Example:
=INDEX(A2:INDIRECT("A"&COUNTA(A:A)),MATCH(E2,B2:INDIRECT("B"&COUNTA(A:A)),0))
You will need to open macro. Then do the following in recorded macro.
+ Filter only non-null value in C/D
+ Select whole column in C/D then copy the whole column
+ Turn off Filter
+ Paste the whole C/D in F/G
+ Stop macro
Gook Luck
Put this formula if F2:
=INDEX(INDEX(C:C,MATCH($E2,$B:$B,0)):INDEX(C:C,MATCH($E2,$B:$B,0)+COUNTIF($B:$B,$E2)-1),MATCH(1E+99,INDEX(C:C,MATCH($E2,$B:$B,0)):INDEX(C:C,MATCH($E2,$B:$B,0)+COUNTIF($B:$B,$E2)-1)))
Copy over one column and down the list.
I'm trying to use Excel to extract figures based on multiple criteria and their location within columns.
So for example. If I wanted to do a SUMIF to receive the figures associated with the First class. The formula would retrieve the figure in a specified row,
But If I wanted to retrieve the figure associated with England. The formula would contain multiple criteria to look for the First class then look for the country England and retrieve the figure on its row in a specified column.
These columns will grow and shrink each month. Meaning I need it to be somewhat dynamic.
I've tried to do this using SUMIF and SUMIFS with no luck.
=SUMIFS(D2:D10,A2:A10,"First",B2:B10,"England")
The challenge you have is that in columns A, B and C, the values are not repeated downwards into the now blank cells. So values do not appear next to each other in the same row.
Assuming that the example you gave is quite simple, and you could also have multiple International Products for a given Class and Country, I would go for the following solution:
Reserve two columns (E and F) for intermediate calculations. If they are currently used, move those used columns to the right, making room for an empty E and F column. You could of course also choose two other columns for this purpose. But I will assume they are E and F.
Then in E2 put this formula and copy it further down the E column as far as needed.
=IF(A2<>"", A2, OFFSET(E2,-1,0))
In F2 put this formula and copy it down as well:
=IF(B2<>"", B2, IF(A2<>"", "", OFFSET(F2,-1,0)))
This should give the following display (the header titles in E1 and F1 are cosmetic only):
Now you can do formulas on those columns in combination with the C column. For instance:
=SUMIFS(D2:D10, E2:E10,"First", F2:F10,"England", C2:C10,"")
And this would output 2. Note that if you really only want to match one row, you should specify a condition for each column (E, F and C).
The intermediate formulas in the E and F columns are quite resistant to deletion of rows, due to the use of OFFSET. If you insert rows, you should of course make sure the formulas in E and F are copied into it.
If you will ever use more than 3 columns for the source data, you'll need to also add more intermediate columns with similar formulas. Also your SUMIFS would need extra conditions then.
You could use the following SUMPRODUCT() For Class and Country:
=SUMPRODUCT(($A$2:$A$10=$F$1)*($B$3:$B$11=$G$1)*($D$3:$D$11))
Then for all three:
=SUMPRODUCT(($A$2:$A$10=$F$1)*($B$3:$B$11=$G$1)*($C$4:$C$12=H1)*($D$4:$D$12))
A picture for references.
The idea is that each column must move down one row in its reference. And the Sum column must start on the same row as the last column being referenced.
I am messing around with Excel 2007 and I'm looking for a solution regarding finding the average of values who share a value in a different column.
The values in column A are all numbers running anywhere from 0 to several dozen. Column B has either Yes or No in it, one for each row. What I am looking for is being able to calculate the average of all values in column A who share the same word in column B.
Initially both will be empty, and only after the field in column A has been filled will column B be filled. The value of column A does not always mean that it always have the same value in column B, meaning that that two instances of the number 8 in A can mean that either, both or neither values in B will be Yes.
I am looking for two formulas to give me these averages: one average for all the Yes numbers and one for all the No ones, but not in VBA.
Thank you in advance!
Not sure I understand, but please try say in D1 and copied down one row:
=AVERAGEIF(B:B,C1,A:A)
where C1 is Yes and C2 is No.