Hi ,

I suggest you add this user-defined function to your code module:

Function FormatFraction(DecimalNumber As Single, Optional SmallestFrac As Integer = 16) As String

' DecimalNumber is the number to be expressed as a whole part and fraction thereof

' Format will display the result in string format, reducing the denominator

' to the smallest possible within the constraints of bringing the number to the nearest

' sixteenth. The optional parameter SmallestFrac allows you to set the largest

' denominator to something other than sixteenths (set to 8 for eights, etc.)

Dim WholePart As Integer

Dim FractPart As Single

Dim Numerator As Integer

Dim Denominator As Integer

WholePart = Fix(DecimalNumber)

FractPart = Abs(DecimalNumber - WholePart)

Denominator = SmallestFrac

Numerator = Fix(FractPart * SmallestFrac + 0.5) '0.5 Rounds to nearest 16th

' Reduce numerator and denominator by factors of 2

Do Until Numerator / 2 <> Numerator \ 2 Or Numerator < 2

Denominator = Denominator / 2

Numerator = Numerator / 2

Loop

' Format the result into a string

If Numerator <> 0 Then

If Denominator = 1 Then

FormatFraction = CStr(WholePart + Sgn(DecimalNumber))

Else

FormatFraction = CStr(WholePart) & " " & CStr(Numerator) & "/" & CStr(Denominator)

End If

Else

FormatFraction = CStr(WholePart)

End If

End Function

Then you could accomplish what you describe via:

For Each c In Range("D:D")

If c.Value = "Total" Then

c.Offset(0, 1) = FormatFraction(Cells(c.Row, "b")) & " x " & FormatFraction(Cells(c.Row, "c") )

End If

Note that the default is for the smallest fraction reduction to be in sixteenths, but that you can make it eighths or whatever by setting it like this:

c.Offset(0, 1) = FormatFraction(Cells(c.Row, "b"),8) & " x " & FormatFraction(Cells(c.Row, "c") ,8)

Next c