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:

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
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.
 
Upvote 0
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])),"""")"
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,223
Members
452,620
Latest member
dsubash

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