search formula returns #VALUE!

viggie79

New Member
Joined
Dec 10, 2015
Messages
14
Im trying to sort out which cells have 'move' in a column so I can separate them out easily. This is probably a huge noob move but this was the way I went with. Im having a problem with my if statement return and just cant figure it out.

I have a worksheet with the following code
Code:
With Range("P1").Resize(lRow, 1)    .Formula = "=IF(SEARCH(""move"",R[0]C[-12],1),""move"",""x"")"  ': .Value = .Value
  End With

The search function works right because I get "move" in every appropriate corresponding cell, but if there is no 'move' in the searched cell it returns #VALUE! instead of 'x' and I can't figure out why.

Ive tried these as well
Code:
With Range("P1").Resize(lRow, 1)    .Formula = "=IF(SEARCH(""move"",R[0]C[-12],1),""move"")"  ': .Value = .Value
  End With
just trying to get a blank cell

Code:
With Range("P1").Resize(lRow, 1)    .Formula = "=IF(SEARCH(""move"",R[0]C[-12],1),""move"","""")"  ': .Value = .Value
  End With
Code:
With Range("P1").Resize(lRow, 1)    .Formula = "=IF(SEARCH(""move"",R[0]C[-12],1),""move"","x")"  ': .Value = .Value
  End With

but I cant seem to get it.

I can live with it returning #Value!, but Id really like to understand what Im doing wrong.
Googling has confused me more because I keep finding #VALUE! being associated with mixing numbers and letters and trying to do math with those, which I don't think is the case here.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
You could set the result of a no match to false like this

.Formula = "=IF(IFERROR(SEARCH(""move"",R[0]C[-12],1),FALSE),""move"",""x"")"
 
Upvote 0

Forum statistics

Threads
1,217,367
Messages
6,136,144
Members
449,994
Latest member
Rocky Mountain High

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