Need a value to be in exponential format and then converted to a text with a symbol in the front.

HankJ

Board Regular
Joined
Mar 5, 2016
Messages
89
Greetings

I use the following notation to report certain values.

>1.000
<0.0001

These values are in units of micromolar.
I would like some code to convert them to the following.

>1.00E-06
<1.00E-10

I have something like this..

Code:
Sub Tidy_IC50()

' Tidy IC50 value if >1.000000
Dim dData As Range, aCell As Range

    Set dData = Range("M5:M9")                 ' s

    For Each aCell In dData.Cells                       '  starts loop in Range aData
        If Left(aCell, 1) = ">" Then
        aCell = Mid(aCell, 2, 10) / 1000000#
        aCell = ">" & aCell
        Else
        aCell = aCell
        End If
    Next

End Sub

Unfortunately is gives me:
>0.0000001

<colgroup><col width="64"></colgroup><tbody>
</tbody>


Any help would be gratefully received.

Best wishes

Hj
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Your code assumes that if the cell does not have a greater or less than sign, it should remain the same?

Well, i modified a portion of it

Code:
Sub Tidy_IC50()


' Tidy IC50 value if >1.000000
Dim dData As Range, aCell As Range


    Set dData = Range("A1:A2")                 ' s


    For Each aCell In dData.Cells                       '  starts loop in Range aData
        If Left(aCell, 1) = ">" Or Left(aCell, 1) = "<" Then
        aCell = Mid(aCell, 2, 10) / 1000000
        aCell = ">" & Format(aCell, "0.E+00")
        Else
        aCell = aCell
        End If
    Next


End Sub
 
Upvote 0
Hi Momentman
That worked an absolute treat.
I really need to work on my formats and this will be a good one to save for the next.

Yes, if the value is inside the limits, then they stay as they are.

Many thanks for your time and knowledge.
Wish you good.

Hj
 
Upvote 0

Forum statistics

Threads
1,214,864
Messages
6,121,986
Members
449,060
Latest member
mtsheetz

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