Check off required criteria

jimrward

Well-known Member
Joined
Feb 24, 2003
Messages
1,896
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
  8. 2003 or older
Platform
  1. Windows
My quest for knowledge continues so here is one for the gurus

To simplify my problem I will try to describe it using a mini golf competition of 9 holes on a par 3 golf course each player is assigned a unique id, hole number, score, so 9 rows for each ID, hole(1-9), score
I can group by uniqueid and sum the score to get total

What I would also like to do is see if any player gets a 2 and 3 and 4 and 5 in their set of 9 holes as a bonus competition
they can get multiples of each required hole score but must tick the box for 2,3,4,5 at least once, so if they don’t get a 2 then it’s a fail
I have tried creating custom columns, IS2,IS3,IS4,IS5 posting 1 for yes in each column but can’t workout how to check for 1,1,1,1 from a grouping
I will post some data later from my pc when I get home
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
After a sleep on it I think I have a solution albeit not very elegant
data set
Book1
ABC
1IDHoleScore
2116
3124
4133
5142
6157
7165
8178
9186
10196
11214
12224
13233
14243
15254
16264
17273
18283
19293
20313
21324
22333
23342
24354
25365
26374
27386
28393
Sheet1


code, C1 to C4 conditions, on grouping TC1 to TC4 total condtions met for the round, last column concatenate TCn together and eliminate ones with a zero
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Hole", Int64.Type}, {"Score", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "C1", each if [Score]=2 then 1 else 0),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "C2", each if [Score]=3 then 1 else 0),
#"Added Custom2" = Table.AddColumn(#"Added Custom1", "C3", each if [Score]=4 then 1 else 0),
#"Added Custom3" = Table.AddColumn(#"Added Custom2", "C4", each if [Score] =5 then 1 else 0),
#"Grouped Rows" = Table.Group(#"Added Custom3", {"ID"}, {{"Total", each List.Sum([Score]), type nullable number}, {"TC1", each List.Sum([C1]), type number}, {"TC2", each List.Sum([C2]), type number}, {"TC3", each List.Sum([C3]), type number}, {"TC4", each List.Sum([C4]), type number}}),
#"Changed Type1" = Table.TransformColumnTypes(#"Grouped Rows",{{"TC1", type text}, {"TC2", type text}, {"TC3", type text}, {"TC4", type text}}),
#"Added Custom4" = Table.AddColumn(#"Changed Type1", "AllTC", each [TC1]&[TC2]&[TC3]&[TC4]),
#"Added Custom5" = Table.AddColumn(#"Added Custom4", "Jackpot", each if Text.Contains([AllTC],"0") then "" else "Jackpot")
in
#"Added Custom5"

End result
Book1
ABCDEFGH
1IDTotalTC1TC2TC3TC4AllTCJackpot
214711111111Jackpot
323105400540
433413311331Jackpot
Table1
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,318
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top