Range with Name Manager

trough

Board Regular
Joined
Oct 26, 2010
Messages
55
In VBA, I have a multi column range on one sheet (DocMgr!$Q$8:$V$27) where, on another sheet, I need to find the max value in the second column if the first columns meets a certain condition. The way I found to do this is to write an array formula to a cell and then get the resulting value like this:

Sheets("Tables").Cells(1, 1).FormulaArray = "=MAX(IF(DocMgr!Q8:Q27=10,DocMgr!R8:R27))"

However, I would like to use the Name Manager to define the range instead of hard-coding it in VBA but it doesn't seem to work. In the Name Manager I have:

MgrTbl = DocMgr!$Q$8:$V$27

In VBA I did this but VBA does not lie it:

Sheets("Tables").Cells(1, 1).FormulaArray = "=MAX(IF(" & Range([MgrTbl]).Columns(1) & "=10," & Range([MgrTbl]).Columns(2) & "))"

Why won't this work? Is there a way to use the Name Manager variable I've created to accomplish what I'm trying to do?
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
How about:
VBA Code:
Sheets("Tables").Cells(1, 1).Formula = "=MAXIFS(INDEX(MgrTbl,0,2),INDEX(MgrTbl,0,1),""10"")"
 
Upvote 0

Forum statistics

Threads
1,224,803
Messages
6,181,055
Members
453,015
Latest member
ZochSteveo

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