Using median if in VBA. Excel. 3 conditions stop running?

L

Lifeseeker

Hi,

I am new to the forum, but I have been tackling this problem all day bu
it's not going any where.....

I am using a median combined with if in VBA using formula array.

code:

Code
-------------------

Set wbPath = Workbooks.Open("H:\All Projects\New CCM TIA SPH Macro test 51 .xlsm", Password:="test")


ThisWorkbook.Activate
Range("F4").FormulaArray = _
"=MEDIAN(if(('[New CCM TIA SPH Macro test 51 .xlsm]SPH Clinic Intake'!C18 = ""ED"")*('[New CCM TIA SPH Macro test 51 .xlsm]SPH Clinic Intake'!C15 ='New CCM Reporting Clinic-Centre'!R4C2)*('[New CCM TIA SPH Macro test 51 .xlsm]SPH Clinic Intake'!C24 =""Yes""),'[New CCM TIA SPH Macro test 51 .xlsm]SPH Clinic Intake'!C19))"

-------------------



I find that if you only use 2 conditions, it runs, but not wit
3.......

However, in the cell above, I am using exactly the same format with
conditions, and it is working. The only difference is that the othe
cell gets its value from worksheet that is in the same workbook, wherea
THIS one gets range from another workbook, but that is not the proble
here?

Is anyone able to assist?

If I got rid of one condition, it works, but not with 2 more....Doe
this have to do with the size of the array?


Thank yo
 
D

Don Guillett

Could be?? Try using a defined name for your range
var1='[New CCM TIA SPH Macro test 51 .xlsm]SPH Clinic Intake'!C18
then test by =var1 in the worksheet
then test by
if var1="ed"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top