Iferror right and find function

Kurt

Well-known Member
Joined
Jul 23, 2002
Messages
1,664
I am now trying to recreate my Excel VBA formula on a worksheet to pick it apart.

I have the following text in cell A1

Code:
MECH~CDA-CUP-PF~1 - CUP0915.2XL - Copper Reducer (P)

I have the following in cell A3:

Code:
=IFERROR(LEFT("A1", FIND("" ~ "")+1, FIND(("-",("A1"))+1,FIND(("-",("A1")+1)


I am getting the error you need to type an apostrophe first.

I tried that and I still get an error.

When I try this formula in VBA it does start to work.

Can someone clue me in?
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
If your data will always be in that format...
=LEFT(A1,FIND("#",SUBSTITUTE(A1,"-","#",2))-1)
 
Upvote 0
Thanks that does indeed work.

How can I put that in the following format:

Code:
    AddFormula TopLeft.Offset(1, 3).Resize(RowCount, 1), "IFERROR(=LEFT(AA & Row & ", Find("#", Substitute(A1, "-", "#", 2)) - 1)

I am getting a Compile error: Expected: end of statement.

I am trying to reverse engineer the vba code that was handed to me.
 
Upvote 0
Upvote 0
In your other thread which you started yesterday,

https://www.mrexcel.com/forum/excel-questions/1086073-extract-characters-cell-using-vba.html

which appears to deal with the same question you are asking here, you first said that you needed to extract:

MECH~CDA-CUP

Then you said that was a mistake and what you actually wanted to extract was

CDA-CUP-PF

So in this new thread, are you sure it is "MECH~CDA-CUP" that you want?


Yes I am now trying to get your formula to work on this line of code:

Code:
    AddFormula TopLeft.Offset(1, 3).Resize(RowCount, 1), "=LEFT(AA" & Row & ",FIND(""#"",SUBSTITUTE(AA" & Row & "," - ",""#"",2))-1)"

Thank you for all of your effort so far!! :)
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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