tuanbuffalo
New Member
- Joined
- Mar 16, 2018
- Messages
- 1
I need to find the maximum value present in column AC against multiple instances of variable X in column D, and populate the value in column F.
For example (apologies, I cannot share a true dataset due to the confidential nature of the data):
[TABLE="class: cms_table_grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Column D[/TD]
[TD]...[/TD]
[TD]Column F[/TD]
[TD]...[/TD]
[TD]Column AC[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]ID[/TD]
[TD]...[/TD]
[TD]MaxSeverity[/TD]
[TD]...[/TD]
[TD]Severity[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]A[/TD]
[TD]...[/TD]
[TD]50[/TD]
[TD]...[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]A[/TD]
[TD]...[/TD]
[TD]50[/TD]
[TD]...[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]B[/TD]
[TD]...[/TD]
[TD]30[/TD]
[TD]...[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]C[/TD]
[TD]...[/TD]
[TD]30[/TD]
[TD]...[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]A[/TD]
[TD]...[/TD]
[TD]50[/TD]
[TD]...[/TD]
[TD]40[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]B[/TD]
[TD]...[/TD]
[TD]30[/TD]
[TD]...[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]B[/TD]
[TD]...[/TD]
[TD]30[/TD]
[TD]...[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]C[/TD]
[TD]...[/TD]
[TD]30[/TD]
[TD]...[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]D[/TD]
[TD]...[/TD]
[TD]50[/TD]
[TD]...[/TD]
[TD]50[/TD]
[/TR]
</tbody>[/TABLE]
I've got a solution which uses nested CountIfs, but it takes around 45s on a dataset of 10k rows and is, well, inelegant to say the least.
Any suggestions from the community?
For example (apologies, I cannot share a true dataset due to the confidential nature of the data):
[TABLE="class: cms_table_grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Column D[/TD]
[TD]...[/TD]
[TD]Column F[/TD]
[TD]...[/TD]
[TD]Column AC[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]ID[/TD]
[TD]...[/TD]
[TD]MaxSeverity[/TD]
[TD]...[/TD]
[TD]Severity[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]A[/TD]
[TD]...[/TD]
[TD]50[/TD]
[TD]...[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]A[/TD]
[TD]...[/TD]
[TD]50[/TD]
[TD]...[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]B[/TD]
[TD]...[/TD]
[TD]30[/TD]
[TD]...[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]C[/TD]
[TD]...[/TD]
[TD]30[/TD]
[TD]...[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]A[/TD]
[TD]...[/TD]
[TD]50[/TD]
[TD]...[/TD]
[TD]40[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]B[/TD]
[TD]...[/TD]
[TD]30[/TD]
[TD]...[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]B[/TD]
[TD]...[/TD]
[TD]30[/TD]
[TD]...[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]C[/TD]
[TD]...[/TD]
[TD]30[/TD]
[TD]...[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]D[/TD]
[TD]...[/TD]
[TD]50[/TD]
[TD]...[/TD]
[TD]50[/TD]
[/TR]
</tbody>[/TABLE]
I've got a solution which uses nested CountIfs, but it takes around 45s on a dataset of 10k rows and is, well, inelegant to say the least.
Any suggestions from the community?