I’d like to count how many times a certain company is audited according to a certain standard. If a company XYZ in a column F is audited according to a certain standard in a column C more than 3 times, it should count as 3. If this company is audited 3 times or less, it should count as it is.
Here is the example (column H is the desired result):
I have tried to solve it with the following formula:
=IF(SUMPRODUCT(($F$2:F2=F2)*($C$2:C2=C2))=1,COUNTIFS($F$2:$F$60000,F2,$C$2:$C$60000,C2),"")
However, I only get the results how many times a certain company is audited to a certain standard. The issue with “count no more than 3 times” is missing :-(
I would appreciate any support, no matter whether with a formula or VBA!
Thanks!
You can implement a MIN() statement, e.g: in H2 try:
=IF(OR(C2<>C1,F2<>F1),MIN(3,COUNTIFS(C$2:C$60000,C2,F$2:F$60000,F2)),"")
And drag down. Swap the OR() back to SUMPRODUCT() if need be.
Untested, since I cannot paste your screenshot of data into a worksheet:
IF(
SUMPRODUCT(
($F$2:F2=F2)*($C$2:C2=C2)
)=1,
MIN(3,COUNTIFS(
$F$2:$F$60000,F2,$C$2:$C$60000,C2)),
"")
Related
My goal is determine how many times a given teammate is matched up with another given teammate over 3 rounds of golf played by 3 different teams. The same roster of 12 players is changed up each round. The goal is to minimize the number of times the players are paired up with the same people over the 3 rounds.
I attempted to use the COUNTIFS formula in excel, but it returns 0 when checking if the name of each player is in the same "Team" range.
In my sheet, i have a table for players to show how many times they are paired up with different people in the 3 rounds. I can't even get it to calculate the matchup from Team 3 in Round 1 (Mike & Matt paired up), let alone move on to summing up the entire set of data.
From the screenshot you can see my equation =COUNTIFS(Q3:Q6,S3,Q3:Q6,T1) in cell T3, referencing the data in Q3:Q6 for the names Mike and Matt.
I've reviewed plenty of examples using COUNTIFS from other types of information/data types, so I don't understand why my formula fails. When I replace one of the cell references to a name with a wild card * then it returns a result of 1. If I take out one of the two references all together it returns a result of 1, for the player name that remains.
=COUNTIFS(Q3:Q6,S3,Q3:Q6,T1)
Q3:Q6 is the table I'm referencing at the moment. The same table is referenced for both players. S3 is Mike and T1 is Matt. Both players are listed in the reference range, so it seems to me that the condition is satisfied for both components.
I don't get any error messages, just a result of 0 when I'm expecting 1.
Because COuNTIFS() is AND not OR So the cell would need to be both Matt and Mike at the same time, which is not possible.
To do OR we need to do something slightly different:
=SUMPRODUCT(COUNTIFS(Q3:Q6,CHOOSE({1,2},S3,T1))
This will return 2 if both are in the range so to get it to 1 we do:
=--(SUMPRODUCT(COUNTIFS(Q3:Q6,CHOOSE({1,2},S3,T1))=2)
Which will now return 1 if both are found in the range and 0 if only one or none are found.
So we can string 9 of these together to get the output you want:
=(SUMPRODUCT(COUNTIF($M$3:$M$6,CHOOSE({1,2},T$1,$S2)))=2)
+(SUMPRODUCT(COUNTIF($O$3:$O$6,CHOOSE({1,2},T$1,$S2)))=2)
+(SUMPRODUCT(COUNTIF($Q$3:$Q$6,CHOOSE({1,2},T$1,$S2)))=2)
+(SUMPRODUCT(COUNTIF($M$10:$M$13,CHOOSE({1,2},T$1,$S2)))=2)
+(SUMPRODUCT(COUNTIF($O$10:$O$13,CHOOSE({1,2},T$1,$S2)))=2)
+(SUMPRODUCT(COUNTIF($Q$10:$Q$13,CHOOSE({1,2},T$1,$S2)))=2)
+(SUMPRODUCT(COUNTIF($M$17:$M$20,CHOOSE({1,2},T$1,$S2)))=2)
+(SUMPRODUCT(COUNTIF($O$17:$O$20,CHOOSE({1,2},T$1,$S2)))=2)
+(SUMPRODUCT(COUNTIF($Q$17:$Q$20,CHOOSE({1,2},T$1,$S2)))=2)
It will now count how many times the pairs were on the same team:
So this is the simplified question I broke down from a former question I had here: Excel help on combination of Index - match and sumifs? .
For this one, I have Table1 (the black-gray one) with two or more columns for adjustments for various order numbers. See this image below:
What I want to achieve is to have total adjustments for those order numbers that contain the numbers in Total Adjustment column in the blue table, each of which will depend on the cell beside it.
Example: Order number 17051 has two products: 17051A (Apple) and 17051B (Orange).
Now what I want to achieve in cell C10 is the sum of adjustment for both 17051A and 17051B, which will be: Apple Adjustment (5000) + Orange Adjustment (4500) = 9500.
The formula I used below (and in the image) kept giving me error messages, and this happens even before I add the adjustment for Orange.
=SUMIF(Text(LEFT(Table1[Order Number],5),"00000"),text(B10,"00000"),Table1[Apple Adjustment])
I have spent the whole day looking for a solution for this and didn’t even come close to find any. Any suggestion is appreciated.
Assuming your headers always have the text "adjustment" in them, you could use:
=SUMPRODUCT((LEFT($B$4:$B$7,5)=B10&"")*(RIGHT($C$3:$F$3,10)="adjustment")*$C$4:$F$7)
In C10 you could add two sumproducts. This assumes that products are always 5 numbers long at the start. If not swop the 5 to use the length of the product reference part you are matching on.
=SUMPRODUCT(--(1*LEFT($B$4:$B$7,5)=$B10),$D$4:$D$7)+SUMPRODUCT(--(1*LEFT($B$4:$B$7,5)=$B10),$F$4:$F$7)
Which with table syntax is:
=SUMPRODUCT(--(1*LEFT(Table1[Order Number],5)=$B10),Table1[Apple Adjustment])+SUMPRODUCT(--(1*LEFT(Table1[Order Number],5)=$B10),Table1[Orange Adjustment])
Using LEN
=SUMPRODUCT(--(1*LEFT(Table1[Order Number],LEN($B10))=$B10),Table1[Apple Adjustment])+SUMPRODUCT(--(1*LEFT(Table1[Order Number],LEN($B10))=$B10),Table1[Orange Adjustment])
I am multiplying by 1 to ensure Left, 5 becomes numeric.
Little issue I'm having that I'm hoping someone can help me with please?
So I have 3 columns in Excel. Each Column (A/B/C) contains either "high" / "Medium" / "Low" scored issues. However, if you have 3 Low issues, this is grouped together, and this becomes 1 Medium Issue for example.
The difficulty I'm having is writing a formula that will do this for me. Obviously I could just divide the number of Low issues I have by 3, but in the case where I have 7 Low issues, It should result with 2 Mediums and 1 remaining Low. I've tried using the "Mod" function, but that only returns the remainder.
What I need is a formula that will say "If you have 7 Low Issues, (3 low = 1 medium), therefore you have 2 medium and 1 Low). The medium issues would then be added to the Medium Column (Col B), and the remaining low issue is counted in the Low issue column (Col C).
I hope this explanation makes sense, fingers crossed one of you might be able to help me! Thank you in advance
As requested, a screenshot!
If I understand you correctly, I think you should be able to adapt the following formulas to meet your needs.
To get the number of occurrences of the word "Low" in column A:
=COUNTIF(A:A, "=Low")
To get the number of "Mediums" from 3 occurrences of "Low" in column A, round down the above number divided by 3:
=FLOOR(COUNTIF(A:A, "=Low")/3,1)
To get the remaining "Lows" after groupings of 3 into "Mediums", use MOD:
=MOD(COUNTIF(A:A, "=Low"),3)
Putting this into a worksheet:
Values
Formulas
Finally, if you wanted one "Mediums" count, i.e. adding the remaining "Mediums" which aren't grouped into "Highs", you would use a combination of the above formulas for what is left after grouping to "Highs" with what is gained from grouping of "Lows".
Edit:
Now you've included an image, I can show how these formulas are directly applicable...
Values
Formulas
Sounds like you were already nearly there with using =MOD() just needed a little tweak:
For the high column:
=COUNTA(A2:A8)+FLOOR(COUNTA(B2:B8)/3,1)
For the medium column:
=FLOOR(COUNTA(C2:C8)/3,1)+MOD(COUNTA(B2:B8),3)
For the low column:
=MOD(COUNTA(C2:C8),3)
It's exactly like a long addition that you do at school where each column carries over to the one to the left of it (except base 3 instead of base 10). I'm not clear that existing answers cover the case where there is a carry from one column and that causes a further carry from the next column so here is another answer
In the totals row (e.g. for the medium column) in (say) C12
=COUNTA(C2:C10)+INT(D12/3)
Then use mod as before
=MOD(C12,3)
except that in the high column you don't want to use MOD so it's just
=B12
I have a list of names with their direct supervisor that I am trying to expand upon by showing the employees the next few layers down that work for the list of names.
Column C of the linked image brings back results of 1-7 by matching the list of names in A to those in the column of 7 names. This shows that "HB" works for "SW" but that "SW" works for "ZJ," so "HB" is technically under "ZJ" too. What I am hoping to accomplish is to have a result similar to that shown below (or something that will show the employees under each supervisor). As shown below, in the data there are many names not being searched for but that are needing to be mapped to those that are being searched for. At the current count there are 1500 employee names with 7 of them being the ones searched out of a list of 143 supervisors that repeat for the employees.
Names to Look for: "Fictional names used for scenario"
Sam W. (SW) 1
Robert R. (RR) 2
Kegan G. (KG) 3
Isiah B. (IB) 4
Orville E. (OE) 5
Robert J. (RJ) 6
Zach J. (ZJ) 7
Column A Column B Column C Column D Column E
Superv. Employ.
HB PJ 7
SW HB 1 7
BE JR 2
HB IL 1 7
IL AP 1
BE WP 2
RR BE 2
KG JW 3
JW JH 3
ZJ SW 7
These results would then be used to create lists of employees under a certain person.
Things I'm not sure affects this would be how the name is constructed in the workbook. Example Sam W. is listed as Wilson, Sam in the workbook.
Of course if there is another way to achieve the final result that would be easier then I wouldn't mind an altered format to what I currently have. If anyone has an idea how to achieve this please respond. If there are any questions about more specific things in the workbook that I could supply that could help resolve this quicker also let me know for any future inquiries I may have. Thank you.
Well, if I understand what you're asking, you need to normalize your data. In this case, that means creating two tables linked by an employee code that you'll need to create.
Once you have these two tables, you can easily perform any query and summary report you need.
Giving a range that contains the 7 names and next to them 7 numbers the name AUarray then in C3 and copied down to suit:
=IFERROR(VLOOKUP(A3,LUarray,2,0),"")
and in D2 and copied down to suit:
=IFERROR(VLOOKUP(INDEX(A:A,MATCH(A3,B:B,0)),LUarray,2,0),"")
I think something similar (but maybe a lot longer!) would work for ColumnE but I don't have time for that at present.
`
I have 3 columns called Book Name, start page, and end page. For each book it has multiple start and end pages (excerpts of the book) such that my data looks something like:
X 1 3
X 5 6
X 10 15
Y ...
Etc. And it's sorted by smallest to largest. What is the best method of writing a formula that finds the "overall" range for the list of books. So for this example I would want to return on another sheet
X 1 15, since the first page that appears is 1 and the last is 15.
My current solution is count the number of times a book name appears and then write some kind of offset formula based on that but since I'm really new to excel I was wondering if anyone could give me some other approaches (especially since I've heard it's best to avoid offset formulas)?
Thanks
Try this formula for the first page if book name is in A2
=INDEX(start_page,MATCH(A2,Book_Name,0))
and for last page [edited as per comments]
=LOOKUP(2,1/(Book_Name=A2),end_page)
Use this formula for first page:
=MIN(IF($A$1:$A$5=$E3,$B$1:$C$5))
and this formula for last page:
=MAX(IF($A$1:$A$5=$E3,$B$1:$C$5))
press CTRL+SHIFT+ENTER to evaluate them.
Edit:
And it's sorted by smallest to largest
didn't notice it. If your data are sorted - the most efficient way would be solution proposed #barry houdini