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:

[TABLE="width: 84"]
<colgroup><col></colgroup><tbody>[TR]
[TD]>100.000000[/TD]
[/TR]
[TR]
[TD]>100.000000[/TD]
[/TR]
[TR]
[TD]>100.000000[/TD]
[/TR]
[TR]
[TD]>100.000000[/TD]
[/TR]
[TR]
[TD]>100.000000[/TD]
[/TR]
[TR]
[TD]>100.000000[/TD]
[/TR]
[TR]
[TD]>100.000000[/TD]
[/TR]
[TR]
[TD]>100.000000[/TD]
[/TR]
[TR]
[TD]>100.000000[/TD]
[/TR]
</tbody>[/TABLE]

to

[TABLE="width: 90"]
<colgroup><col></colgroup><tbody>[TR]
[TD]> 1.00E-04[/TD]
[/TR]
[TR]
[TD]> 1.00E-04[/TD]
[/TR]
[TR]
[TD]> 1.00E-04[/TD]
[/TR]
[TR]
[TD]> 1.00E-04
[/TD]
[/TR]
[TR]
[TD]> 1.00E-04[/TD]
[/TR]
[TR]
[TD]> 1.00E-04[/TD]
[/TR]
[TR]
[TD]> 1.00E-04[/TD]
[/TR]
[TR]
[TD]> 1.00E-04[/TD]
[/TR]
[TR]
[TD]> 1.00E-04
[/TD]
[/TR]
</tbody>[/TABLE]

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

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
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,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

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