How to enter this multi-line formula?

rollingzep

Board Regular
Joined
Nov 18, 2013
Messages
215
Office Version
  1. 365
Platform
  1. Windows
<p>

I am trying to enter this lengthy formula in multi line but it is incorrect
How to enter the correct way?
I tried a space and an underscore, and as below but it is incorrect </p>

<code>
lrow = ws.Cells(Rows.Count, "BC").End(xlUp).Row
ws.Range("BC2").Formula =
"=IF(BE2=""A-0"",""1"",IF(BE2=""A-1"",""1"",IF(BE2=""A-2"",""1"",IF(BE2=""A-3"",""1"", " & _
"IF(BE2=""A-4"",""1"",IF(BE2=""A-5"",""1"",IF(BE2=""S-1"",""1"",IF(BE2=""S-2"",""1"", " & _
"IF(BE2=""S-3"",""1"",IF(BE2=""S-4"",""1"",IF(BE2=""G-1"",""2A"",IF(BE2=""G-2"",""2A"", " & _
"IF(BE2=""G-3"",""2A"",IF(BE2=""S-5"",""2A"",IF(BE2=""S-6"",""2A"",IF(BE2=""S-7"",""2A"", " & _
"IF(BE2=""E-1"",""2B"",IF(BE2=""E-2"",""2B"",IF(BE2=""IG-1"",""2B"",IF(BE2=""IG-2"",""2B"", " & _
"IF(BE2=""S-8"",""N"",IF(BE2=""G-4"",""N"",IF(BE2=""E-3"",""N"",IF(BE2=""E-4"",""N"", " & _
"IF(BE2=""IG-3"",""N"",IF(BE2=""IG-4"",""N"",IF(BE2=""IG-5"",""N"",IF(BE2=""IG-6"",""N"", " & _
"IF(BE2=""IG-7"",""N"",IF(BE2=""N-1"",""N"",IF(BE2=""N-2"",""N"",IF(BE2=""N-3"",""N"", " & _
"IF(BE2=""N-4"",""N"",IF(BE2=""N-5"",""N"",IF(BE2=""N-6"",""N"",IF(BE2=""N-7"",""N"", " & _
"IF(BE2=""L-1"",""N"",IF(BE2=""L-2"",""N"",IF(BE2=""L-3"",""N"",IF(BE2=""L-4"",""N"", " & _
"IF(BE2=""L-5"",""N"",IF(BE2=""L-6"",""N"",IF(BE2=""L-7"",""N"",IF(BE2=""L-8"",""N"", " & _
"IF(BE2=""L-9"",""N"",IF(BE2=""L-10"",""N"",IF(BE2=""L-11"",""N"", " & _
"IF(BE2=""Y-1"",""N"",IF(BE2=""Y-2"",""N"",IF(BE2=""Y-3"",""N"",IF(BE2=""C-1"",""N"", " & _
"IF(BE2=""Z-1"",""N""))))))))))))))))))))))))))))))))))))))))))))))))))))"
</code>
 
Because the code tells it to in the Range.
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Because the code tells it to in the Range.
Sorry to monopolize your time and patience!
When I commented as you suggested, it populates the header row and the row below. Other rows are empty and the formula is not populated.

1657128508599.png
 
Upvote 0
In that case what is the value of LRow?
 
Upvote 0
You need to use a different column to find the last row, as BC will be empty until you add the formula.
 
Upvote 0
You need to use a different column to find the last row, as BC will be empty until you add the formula.
you are correct! I used a diff column for lrow calculations and it worked.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
Also, if my data starts at row 2 and ends at row 53, how to modify the formula, ws.Range("BC2").FormulaR1C1 = "=VLOOKUP(R2C57,Tabel1,2,0)"?
the headers for that table can be renamed, they have no importance and if you also rename your table as "Rollingzep" then you replace "tabel1" with "Rollingzep" in that line.
If you still have problems, join that table with the XL2BB-tool.
 
Upvote 0

Forum statistics

Threads
1,216,846
Messages
6,133,051
Members
449,777
Latest member
chrixpowell

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