how to delete values with no decimal points?

pooja2010

New Member
Joined
Jan 17, 2012
Messages
42
Hello all,

I have a huge excel file with several rows and columns with quantitative values, which looks like follows..

0.5511245541195570.3117026876664430.6571825793010940.851646583899870.656711634907342
0.5037338880189340.2073738162848680.5757161140286290.8615859472133110.62342783542161
0.4839661955798030.3372814949708490.5709843911704530.9206442194629520.64148173879859
0.06253047468122990.1639894350516111,00E+140.8128250492810410.088216346651155
0.08195824709263790.1963554785269731,00E+140.8737117929626550.0555090833383204
0.521308470121770.2858803327638410.6407438476181090.8959342849879550.617790210479352
0.06007700032317610.1753862313100591,00E+140.9087550368813620.0449497976538427
0.4709953862212470.2528211220123230.5680493909448190.8181775395448790.60534403964158
0.5271848613839560.2820636926156080.6554316928033210.8404094450917110.623304188292984

<colgroup><col span="2"><col><col span="2"></colgroup><tbody>
</tbody>

<colgroup><col span="2"><col><col span="2"></colgroup><tbody>
</tbody>


The file is really huge and I need it for my analysis. However i have some values which are wrong. The values like "1,00E+14" are spread randomly across this huge file and I cannot look for them and delete one by one. Is there a way or a code with which excel can find and delete these wrong numbers across the whole file?

Your help appreciated.
Thanking you.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Ron Coderre

MrExcel MVP
Joined
Jan 14, 2009
Messages
2,316
EDITED TO OFFER A SOLUTION THAT MATCHES YOUR DESCRIPTION OF UNWANTED CELL CONTENTS

In your sample the cells contained values like this: 1,00E+14.
If that's accurate, try this

• Select the range of data cells
• CTRL+H
...Find: ,
...Replace with: KEEP
...Click: Replace all
...Click: Close

• Press F5
...Click: Special
...Check: Constants
...Leave only TEXT checked
...Press: Delete

That should remove all cells that contain a comma.


Does that work for you?
 
Last edited:
Upvote 0

pooja2010

New Member
Joined
Jan 17, 2012
Messages
42
Hi Ron,

Thanks for your reply. I had tried that. But the excel does not seem to search for the comma "," .. Says "excel cannot find the data you are searching for".. Is there any other way you can know of ?
 
Upvote 0

nuked

Well-known Member
Joined
Mar 20, 2013
Messages
883
Something like this? Assuming all 'wanted' values are less than 1. Amend as necessary.

Code:
Option Explicit
Sub GetRid()
Dim cel As Range
For Each cel In ActiveSheet.Cells
    If Not IsNumeric(cel) Or cel.Value > 1 Then
        cel = ""
    End If
Next cel
End Sub
 
Upvote 0

kevatarvind

Well-known Member
Joined
Mar 3, 2013
Messages
1,047
Office Version
  1. 365
Platform
  1. Windows
Code:
Sub Remove_Unwanted()
Dim rmv As Range
For Each rmv In ActiveSheet.UsedRange
    If Not IsNumeric(rmv) Or rmv.Value > 1 Then
        rmv = ""
    End If
Next rmv
End Sub
 
Upvote 0

Ron Coderre

MrExcel MVP
Joined
Jan 14, 2009
Messages
2,316
Yes, I don't know what I was thinking when I posted that

This should work:
• Select the range of data cells
• CTRL+H
...Find: . <----Period or whatever your separator is
...Replace with: KEEP
...Click: Replace all
...Click: Close
That converts cells with decimals to text values


• Press F5
...Click: Special
...Check: Constants
...Leave only NUMBER checked
...Press: Delete

That should remove all cells that displayed a comma.

• Select the range of data cells (again)
• CTRL+H
...Find: KEEP
...Replace with: . <----Period or whatever your separator is
...Click: Replace all
...Click: Close

that restores the text cells back to numeric.

Does that help?
 
Upvote 0

Forum statistics

Threads
1,191,166
Messages
5,985,051
Members
439,935
Latest member
Monty238

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
Top