convert string with a decimal to a string with a exponential

HankJ

Board Regular
Joined
Mar 5, 2016
Messages
89
Hello

I would like to convert a string with a decimal value >100.00000, which are in units of µM to a string with an exponential value, > 1.00E-04.

For example:

>100.000000
>100.000000
>100.000000
>100.000000
>100.000000
>100.000000
>100.000000
>100.000000
>100.000000

<colgroup><col></colgroup><tbody>
</tbody>

to

> 1.00E-04
> 1.00E-04
> 1.00E-04
> 1.00E-04
> 1.00E-04
> 1.00E-04
> 1.00E-04
> 1.00E-04
> 1.00E-04

<colgroup><col></colgroup><tbody>
</tbody>

the bit of code I am using changes everything to >0.0001!

Code:
If Left(Selection.Value, 1) = ">" Then
Selection.Offset(0, -1).FormulaR1C1 = _
"=MID(RC[1],2,SEARCH(CHAR(127),SUBSTITUTE(RC16,""."",CHAR(127),1))-2)/1000000"
Selection.Offset(0, 2).Value = Selection.Offset(0, -1).Value
Selection.Offset(0, 2).NumberFormat = "0.00E+00"
ConcVal = Selection.Offset(0, 2).Value
Selection.Offset(0, 2).Value = "> " & ConcVal
Selection.Offset(0, -1).Value = ""
Selection.Value = ""

This was an attempt to force the value to be a string but does not quite work.

I would be grateful for suggestions.

Many thanks

Hankj
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Try
Code:
ConcVal = Format(Selection.Offset(0, 2).Value, "0.00E+00")
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,176
Messages
6,123,470
Members
449,100
Latest member
sktz

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