I have kind of a complicated count I can't seem to figure out. Basically I have a table that looks similar to this image:
Now what I need to do is:
Tally the number of 1's if the category = "Anon" in one cell, then count the number of 2's and 3's in separate cells all if the category = "Anon".
Wash/Rinse/Repeat for if it's "Watterson" and "Davis".
Is there any way I can count the occurrences of 1|2|3 and have it separated by category like this?
Sorry, kind of an Excel noob here. I didn't think pivot tables would be correct though (especially because they want the dates to be columns, plus I couldn't figure out how to insert a conditional). Any pointers in the right direction would be appreciated.
Let's suppose that your screenshot shows cells A1:I6.
Then ...
Add column headings "1", "2", "3" in cells J1:L1
Put the formula =COUNTIF($C2:$I2,J$1) into J2 and copy it across and down
Set up a list of unique Categories (Anon, Watterson etc) starting in A10
Add headings in row 9 like "Category", "Tally of 1s", "Tally of 2s", "Tally of 3s"
Put the formula =SUMIF($B$2:$B$6,$A10,J$2:J$6) into B10 and copy it across and down
My guess is that someone cleverer than I could construct a sumproduct formula for B10 that works without the need for the helper columns J:L.
[Edit] Using Maki's sumproduct formula in my structure, you can scrap helper values in cols J:I and put this into B10 -- =SUMPRODUCT(($B$2:$B$6=$A10)*($C$2:$I$6=B$9))
assuming that you start from cell A1,
=SUMPRODUCT((list name to search for)*(value to search in the data area))
=SUMPRODUCT(($B$2:$B$6="Anon")*($C$2:$I$6=1))
=SUMPRODUCT(($B$2:$B$6="Anon")*($C$2:$I$6=2))
...
=SUMPRODUCT(($B$2:$B$6="Watterson")*($C$2:$I$6=1))
...etc.
Related
I am trying to create an output in excel based off the number of words in cells. Essentially i want to check if the sum of the words in 3 cells is = 1,2 or >=3. Im using the len formula which i have successfully used on single cell conditions but im struggling to create the formula that would check multiple cells.
Below is an example of my data:
Column A Column B Column C
Cat;dog Bird
Formula
=SUMIF(AND(LEN(TRIM(A4))-LEN(SUBSTITUTE(B4," ",""))+1, LEN(TRIM(C4))-LEN(SUBSTITUTE(C4," ",""))+1, >=3), "Titanium")
https://docs.google.com/spreadsheets/d/1W6nFr-W0r-XWZnvrFWndsvdBEEGHMQUa/edit?usp=sharing&ouid=103068518904190156690&rtpof=true&sd=true
First I made a single formula to work on a single cell. It ignores semicolons and commas to calculate total words. That formula is in column F and it's:
=IF(LEN(E5)=0;0;LEN(TRIM(SUBSTITUTE(SUBSTITUTE(E5;";";" ");",";" ")))-LEN(SUBSTITUTE(TRIM(SUBSTITUTE(SUBSTITUTE(E5;";";" ");",";" "));" ";""))+1
Notice I added an IF to make sure that blank cells will count as 0 words (because the +1 will be added wrongly and we need to avoid this.
Now you just need to sum up all results and we get 8 words.
What you want is to get this result with a single formula and that can be perfomed with array formulas. In cell F11 my formula is:
=SUM(IF(LEN(E5:E8)=0;0;LEN(TRIM(SUBSTITUTE(SUBSTITUTE(E5:E8;";";" ");",";" ")))-LEN(SUBSTITUTE(TRIM(SUBSTITUTE(SUBSTITUTE(E5:E8;";";" ");",";" "));" ";""))+1))
You need to introduce this formula pressing CTRL+ENTER+SHIFT or it won't work!
Now you got the result in a single formula and you just need to add your conditions mentioned in your post
UPDATE: In your Google Sheets, the correct formula would be:
=ArrayFormula(IF(SUM(IF(LEN(TRIM(A3:B3))=0,0,LEN(TRIM(A3:C3))-LEN(SUBSTITUTE(A3:C3," ",""))+1))>=3,"Good","Bad"))
Please, notice Excel is not the same as Google Sheets so sometimes the formulas may be different in one of them.
I want excel to create column B. Basically an arbitary id for each "level of A". in Stata this would be egen groupid = group(A) or in R you could use dplyrs group_indices(). Whats the best way to do it in Excel? Preferably a non-VBA solution.
Formulas for these situations are better when the first row holds unrelated column labels instead of data.
For your situation, put a 1 in B1 then this formula in B2 and drag down.
=IFERROR(VLOOKUP(A2, A$1:B1, 2, FALSE),SUMPRODUCT(1/COUNTIF(A$1:A2,A$1:A2&"")))
I would like to lookup a value in another excel file that will have multiple results as rows. For example If the specific value is found in the column A of that row I want to add the number in column c to a total and then output that.
Book 1 VLookup from this sheet :
Book 2 Vlookup destination:
Desired Result:
I would normally add what I have tried, but im completely stumped, the only real formula ive tried is a standard VLookup. The Watered down question is "Need to know: how many sales per unique sku?"
As #BigBen suggested in the comment, use =SUMIF() formula.
in a pseudocode: =SUMIF(range_to_check, product_name, sales_amount_range)
So with the following data:
The formula in E1 which you can drag to other cells in the column would look like:
=SUMIF(A1:A6, D1, B1:B6)
I need help with creating sum formula on Excel sheet.
I need on excel show sum formula without specific rows. In these rows for example is word "W" or something other way. And I need show sum for example:
=SUM(A1:A5) ........ without if column E have = "W"
I tried checkbox solution, but I finding other better solution:
Please can you help me, how can I do it?
EDIT :
i also posting you my excel sheet what i tried from your solution, but not working:
example of excel sheet
You are looking for something like =SUMPRODUCT(--(NOT(E1:E5="W")),A1:A5). Sumproduct multiplies everything in one column with everything in another, and sums the results. -- converts a boolean statement into a 1 or a 0.
So, with this formula, you would be multiplying each item in column A with either a 1 or a 0. Obviously, things multiplied by zero do not have any effect on the final sum :)
You could use SUMIF formula to only sum column A if the column E has a value of W like below:
=SUMIF(E:E,"w",A:A)
Please pardon my poor explanation of my problem, any insight would be greatly appreciated.
I am using an average in excel that begins at a fixed cell and fills down.
For example: column B contains values, and column C contains the formula =AVERAGE($B$1:B1) filled down, so at row 10 the formula is =AVERAGE($B$1:B10)
I am wondering if there is a way to calculate this average that will "reset" when the value in the column A changes. Getting a formula for whether column A changes is easy using an IF function but I don't know how to change the reference cell when the average "resets." I attempted to attach an image with the formulas but I do not have 10 reputation so here is a link to a short example sheet:
https://drive.google.com/file/d/0BymZUcneHsYgUnRoYkRkdnJYbmM/view?usp=sharing
I would prefer do accomplish this without VBA if possible.
Thank you very much.
EDIT: would it be possible to have a count function next to the data column that starts over when column A switches from "A" to "B" (or "B" to "A"), then I could simply use an average offset with the resulting value to get the desired average?
You should use the =AVERAGEIF function.
=AVERAGEIF($A$1:A1,A1,$B$1:B1)
Here's how I ended up solving this:
I used =ROW()-MAX(INDEX((A$1:A2<>A2)*ROW(A$1:A2),0 to count down until "A" changed to "B" or vice versa, then used =ROW()-MAX(INDEX((A$1:A2<>A2)*ROW(A$1:A2),0 to average the data with the offset calculated in the previous formula.
Note that the data was still in column B, with "A" or "B" in column A, and these two formulas were placed in I and J, respectively
Thank you very much for all your help
You can use Indirect to resolve a custom range. Since values in "A" can come multiple time in distinct block, you will have to add an extra column to keep track of the starting row of each range :
(starting from row 2, [C1] = 1)
=IF(A2<>A1,ROW(A2),C1)
the result will be in column "D" :
=AVERAGE(INDIRECT("B"& C1 &":B"&ROW(A1)))