himperson1
New Member
- Joined
- Jun 23, 2016
- Messages
- 33
Hello. I'm looking for some help with the following:
I need to find the mode of an array that changes based on the day of the month and which shift im looking at.
Ex:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Day[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]2[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]3[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Shift[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Level[/TD]
[TD]Empty[/TD]
[TD]Min[/TD]
[TD]Min[/TD]
[TD]Max[/TD]
[TD]Min[/TD]
[TD]Max[/TD]
[TD]Empty[/TD]
[TD]Max[/TD]
[TD]Max[/TD]
[/TR]
</tbody>[/TABLE]
If I wanted to find the mode of 1st shift until the 3rd of the month, the output result is "Empty"
The array it is looking at would be {Empty, 0, 0, Max, 0, 0, Empty, 0, 0}
If I wanted to find the mode of 2nd shift until the 2nd of the month, the output result is "Min"
The array it is looking at would be {0, Min, 0, 0, Min, 0}
I have found the following code to potentially use, but I am having difficulties making it fit my spreadsheet.
I use the following code elsewhere in my spreadsheet to find the sum of a similar array
Thank you
I need to find the mode of an array that changes based on the day of the month and which shift im looking at.
Ex:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Day[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]2[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]3[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Shift[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Level[/TD]
[TD]Empty[/TD]
[TD]Min[/TD]
[TD]Min[/TD]
[TD]Max[/TD]
[TD]Min[/TD]
[TD]Max[/TD]
[TD]Empty[/TD]
[TD]Max[/TD]
[TD]Max[/TD]
[/TR]
</tbody>[/TABLE]
If I wanted to find the mode of 1st shift until the 3rd of the month, the output result is "Empty"
The array it is looking at would be {Empty, 0, 0, Max, 0, 0, Empty, 0, 0}
If I wanted to find the mode of 2nd shift until the 2nd of the month, the output result is "Min"
The array it is looking at would be {0, Min, 0, 0, Min, 0}
I have found the following code to potentially use, but I am having difficulties making it fit my spreadsheet.
Code:
= INDEX(rng,MODE(IF(rng<>"",MATCH(rng,rng,0))))
I use the following code elsewhere in my spreadsheet to find the sum of a similar array
Code:
=SUMPRODUCT(--(MOD(COLUMN(INDIRECT("'MS'!E"&MS!$A$35&":"&A$1&MS!$A$35))-COLUMN(INDIRECT("'MS'!E"&MS!$A$35))+1,3)=1),INDIRECT("'MS'!E"&MS!$A$35&":"&A$1&MS!$A$35))
Thank you