Index with Match and Min/Max

reberryjr

Well-known Member
Joined
Mar 16, 2017
Messages
714
Office Version
  1. 365
Platform
  1. Windows
I'm trying to get the max value from column AG on the Stats worksheet, where the value in column C of the Client Summaries Sheet matches the value of column C on the Stats sheet. From the couple of examples I've seen online, that actually list all 3 parts, this is coded correctly, but I'm getting a #N/A error. Would someone mind showing me what I have mixed up here?

=INDEX(Stats!AG:AG,MATCH(MAX('Client Summaries'!C:C),Stats!C:C,0))
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
If columnC of Stats sheet doesn't have the result of "MAX('Client Summaries'!C:C)", it says #N/A.
 
Upvote 0
I actually JUST finished working through it some more and found my solution. The end goal was to enter the formula via VBA, when a cmd button was clicked. When I posted the question, I was trying to create the formula in excel, which I was finally able to do. When I posted this last night, I was very tired and this morning, realized that I wasn't referring to a specific cell to find the match on, so I just switched to an IF statement. Then, I just converted it to the VBA equivalent.

Code:
ws1.Range("M" & LastRow1 + 1).FormulaArray = "=MIN(IF(Stats!C[-10]='Client Summaries'!RC[-10],Stats!C[-4]))"
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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