Return a row value based on the row with highest max value, based on date range.

WesLee91

New Member
Joined
Dec 21, 2015
Messages
15
I've seen some similar questions for this, however none were suited correctly.
I'm wondering if I can return a row cell based on the max value in the same row, but different cell.
So I have this;

Code:
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;"> | A | B | Date 
1| X | 2 | 01/01/17
2| Y | 3 | 17/01/17
3| Z | 4 | 18/01/17
4| X | 2 | 21/01/17
5| Y | 3 | 03/02/17
6| Z | 4 | 03/02/17
7| Z | 4 | 07/03/17
8| Z | 4 | 09/03/17
9| Y | 3 | 13/03/17</code>

So Column A displays a string, and Column B counts how many times that Column A string is repeated. I have another sheet with a row for each month, being 01, 02, 03, 04, etc. I am trying to get the string from Column A, which the highest value in Column B, grouped by each month. So for the above example, the next sheet would look as so;

Code:
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">      |   A  | B 
1(Jan)| X    | 2
2(Feb)| Draw | 1
3(Mar)| Z    | 2</code>

If anyone has any ideas on how I could achieve this, it would be much appreciated!

Edit; I've managed to figure parts of it out, I have been able to get the most common name (without checking for multiples) using

Code:
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">=OFFSET(A1,MATCH(MAX(Count),Count,0),0)</code>

Now I just need a way to merge that formula with this one;

Code:
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">=IF(AND(Dates >= DATE(2017,9,1), Dates <= DATE(2017,9,EOMONTH(9,0))),)</code>

How do I pass the results of the =IF to the =OFFSET, or vise-versa?
 
Last edited:

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Just to post I managed to sort this, I had to modify the data to only count within the date (also hidden day) so

Code:
<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; line-height: inherit; border: 0px; font-variant: inherit; font-stretch: inherit; vertical-align: baseline; white-space: inherit;"> | A | B | Date 
1| X | 2 | 01/17
2| Y | 1 | 01/17
3| Z | 1 | 01/17
4| X | 2 | 01/17
5| Y | 1 | 02/17
6| Z | 1 | 02/17
7| Z | 2 | 03/17
8| Z | 2 | 03/17
9| Y | 1 | 03/17
</code>
<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; line-height: inherit; border: 0px; font-variant: inherit; font-stretch: inherit; vertical-align: baseline; white-space: inherit;">
</code>
B column now only counts each time the A cell appears in that month, meaning I was able to use this;

Code:
{=IFERROR(INDEX(Users,MATCH(MAX(Count)&DATE(A$2,B10,1), Count & Dates,0)),"No Data")}

Array Formula of course

To get the most common User within that month. If anyone can help me with Draw clause though, it would be appreciated!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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