# Loop through range, evaluate value, convert to fractional #

#### DougStroud

##### Well-known Member
Working on line of code that will evaluate for a value and make changes w/ code.

Loop through the Range F4:F.

If in the range of F4:F the value "Hat" or "Shoe" is present, Then
offset to column "M" and test if the corresponding value is numeric, if it is and if it is a decimal value, convert to a fractional value.

Example:
F887 = "Hat"
M887 = "7.25"
Convert M887 to "7 1/4" (without quotes)

Here is where I am;
Code:
``````For Each c In Range("F4:F" & LRow)
if c.Value="Hat" & c.offset(isnumeric(0,7)) and if c.value/1 <>1 then``````

Thanks,

Doug

### Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a \$25,000 loan, 5% annual interest, 60 month loan.

#### DougStroud

##### Well-known Member
I am cobbling this together-
I have the loop finding the first value "Hat" and does the formula portion of the procedure.
I need to add a second If statement to determine if it is Numeric.
My code is failing on the second If

Code:
``````For i = 1 To LRow
If Cells(i, "F") = "Hat" if cells(isnumeric(i,"m")Then
Cells(i, "M").Value = Cells(i, "M") / 2
End If
Next i``````

Replies
3
Views
1K
Replies
8
Views
1K
Replies
7
Views
435
Replies
8
Views
382
Replies
3
Views
1K

1,191,721
Messages
5,988,303
Members
440,148
Latest member
sandy123

### 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.

### Which adblocker are you using?

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

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