Add If and IsError to vba folmula

capson

Board Regular
Joined
Jul 9, 2010
Messages
107
Hello,

I have VBA formula and I need to add If & IsError due to empty cells, I have tried
Code:
"=If(ISERROR(LEFT(RC[-1],FIND("", "",RC[-1])-1)),"",LEFT(RC[-1],FIND("", "",RC[-1])-1))"

But not working

Thanks for any help on this

Code:
Sub SplitColumn()
Dim ws As Worksheet


Set ws = ThisWorkbook.Sheets("FuzzyMatched")
    lr = ws.Cells(ws.Rows.Count, "C").End(xlUp).Row


  ws.Range(CL & "1:" & CL & lr).FormulaR1C1 = "=LEFT(RC[-1],FIND("", "",RC[-1])-1)"
  ws.Range("E1:E" & lr).FormulaR1C1 = "=RIGHT(RC[-2],LEN(RC[-2])-FIND("", "",RC[-2]))"
  
End Sub
 
Last edited:

Some videos you may like

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,935
Office Version
  1. 365
Platform
  1. Windows
If you turn on the Macro Recorder, and record yourself typing it into Excel manually, it will record the code that you need for your formula.
 

capson

Board Regular
Joined
Jul 9, 2010
Messages
107
Thanks, that helped

This works
Code:
 ws.Range(CL & "1:" & CL & lr).FormulaR1C1 = "=IFERROR(LEFT(RC[-1],FIND("", "",RC[-1])-1),"""")"
  ws.Range("E1:E" & lr).FormulaR1C1 = "=IFERROR(RIGHT(RC[-2],LEN(RC[-2])-FIND("", "",RC[-2])),"""")"
 

Watch MrExcel Video

Forum statistics

Threads
1,122,738
Messages
5,597,829
Members
414,180
Latest member
Sir Khaya

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
Top