Copy/Paste cells containing only numbers with .50 in it

H

HunterX

I have been trying to come up with a formula that will read each cell in a
column and copy & paste only the cells that contain numbers with .50. I can
seem to properly configure the formula to read any whole number as long as it
contains .50 in it. I want these vnumbers pasted into a seperate column.

=IF(D21="*"+"0.50"),(D21),("")

Thank you very much for your assistance.
 
G

Gord Dibben

=IF(D21-INT(D21)=0.5,D21,"")

If you truly want the numbers copied and pasted you would have to use VBA.


Gord Dibben MS Excel MVP
 
G

Gary''s Student

Install this event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set A1 = Range("A1")
Set B1 = Range("B1")
Set C1 = Range("C1")
If Intersect(Target, A1) Is Nothing Then Exit Sub
If Not IsEmpty(B1) Then Exit Sub
If Not IsEmpty(C1) Then Exit Sub
Application.EnableEvents = False
A1.Clear
Application.EnableEvents = True
End Sub


Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top