Help with building double if statement

sobieskitech

New Member
Joined
Dec 13, 2017
Messages
5
Hello all,

I've looked for solutions to this is the Forum and have probably just missed it.

With the example below I would like to do the following:
1. Look in column D and if the first 3 characters of the cell is BAL then,
2. Look in column C and determine if the character preceding the dash is a letter
3 If the last 2 statements are true then replace the "-00" with ""
like this
Code:
Selection.Replace What:="-00", Replacement:=""

[TABLE="class: grid, width: 300"]
<tbody>[TR]
[TD][/TD]
[TD]C[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]301640A-00[/TD]
[TD]BAL_OS361D[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]301501B-00[/TD]
[TD]BAL_OS361F[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]20392C-00[/TD]
[TD]BAL_OS366B[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]ASGQHAR01001-00[/TD]
[TD]BAL_OS363F[/TD]
[/TR]
</tbody>[/TABLE]


then continue looping till the end of the page.

Thanks in advance for any help
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
See if this works. Test on a copy as its going to overwrite your data:

Code:
lr = Range("C" & Rows.Count).End(xlUp).Row
 
Set x = Range("C1:C" & lr)
x = Evaluate(Replace("IF(ROW(1:" & lr & "),IF(ISERROR(MID(@,FIND(""-"",@)-1,1)+0),IF(LEFT(OFFSET(@,0,1),3)=""BAL"",SUBSTITUTE(@,""-00"",""""),@),@))", "@", x.Address))
Range("C1:C" & lr) = x
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,212
Members
452,618
Latest member
Tam84

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