tjak

Board Regular
I have to split a downloaded report to 6 people based on a matrix. I have a 6-level, nested and/if formula, but it doesn't work in a module. Even if it did, I'm sure there are better ways to do this, but I don't know how. I get a lot of "expected end of statement" errors.
Any suggestions will be welcomed, but I ask that you comment them heavily as I'm trying to learn.

Thanx, again, to all.

Range("D2:d100").FormulaR1C1 = "=IF(AND(LEFT(rc[1],3)=""MED"", (rc[3])>2500),""1"",IF(AND(LEFT(RC[1],3) _
<>""MED"",(rc[3])>2500),""2"",IF(AND(LEFT(RC[1],3)=""MED"",(rc[-3])<""M""),""3"" _
,IF(AND(LEFT(RC[1],3)=""MED"",(rc[-3])>""L""),""4"",IF(AND(LEFT(RC[1],3)<>""MED"",(rc[-3])<""L"", _
""5"",""6"")))))"

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hi

Worked through the formula (but not the logic) and found a mismatch with the brackets. Try

Code:
``Range("D2:d100").FormulaR1C1 = "=IF(AND(LEFT(RC[1],3)=""MED"",RC[3]>2500),""1"",IF(AND(LEFT(RC[1],3)<>""MED"", RC[3]>2500),""2"",IF(AND(LEFT(RC[1],3)=""MED"", RC[-3]<""M""),""3"",IF(AND(LEFT(RC[1],3)=""MED"", RC[-3]>""L""),""4"",IF(AND(LEFT(RC[1],3)<>""MED"", RC[-3]<""L""),""5"",""6"")))))"``

Tony

Replies
16
Views
324
Replies
16
Views
465
Replies
4
Views
494
Replies
3
Views
149
Replies
7
Views
107

1,196,516
Messages
6,015,678
Members
441,915
Latest member
sm Hussaini

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.

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

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