Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2008

Tip: Looking for answers? Try searching our database.

Code to find specific number and calculate

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Annette - 31 Jan 2008 14:32 GMT
Hi!  How would I write into my code to look in cells in column one for a
specific number and then divide by 25.  Here's a sample of the number:

col 1                        col 2        col 3
02.3892.067.033     descrip.    2025

I want the macro to see the .067 in the cell, and then in column four,
divide the number found in column three by 25 and display number in column
four.

So what the result displayed:  col 4 would be 81

I hope this makes sense.

Thanks for any help provided.

Annette
Nigel - 31 Jan 2008 14:47 GMT
You could use a formula in column D as follows....

=IF(ISERROR(FIND(".067",A2)),"Not found",C2/25)

The text ".067" could be a reference to another cell of course.

Signature

Regards,
Nigel
nigelnospam@9sw.co.uk

> Hi!  How would I write into my code to look in cells in column one for a
> specific number and then divide by 25.  Here's a sample of the number:
[quoted text clipped - 13 lines]
>
> Annette
Bob Phillips - 31 Jan 2008 14:50 GMT
=IF(ISNUMBER(FIND(".067",A1)),C1/25,"")

Signature

---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

> Hi!  How would I write into my code to look in cells in column one for a
> specific number and then divide by 25.  Here's a sample of the number:
[quoted text clipped - 13 lines]
>
> Annette
Mike H - 31 Jan 2008 14:53 GMT
Or in a macro

Sub stance()
Set myrange = Range("A1:A100")
For Each c In myrange
  If InStr(1, c.Value, "067", 1) > 0 Then
  On Error Resume Next
       c.Offset(0, 3).Value = c.Offset(0, 2).Value / 25
   End If
Next
End Sub

Mike

> Hi!  How would I write into my code to look in cells in column one for a
> specific number and then divide by 25.  Here's a sample of the number:
[quoted text clipped - 13 lines]
>
> Annette
Annette - 31 Jan 2008 14:58 GMT
Thanks, Mike ... this is exactly what I need, now I should be able to modify
for the other numbers to divide by different amounts other than 25!

This works really well!

Annette

> Or in a macro
>
[quoted text clipped - 28 lines]
>>
>> Annette
Mike H - 31 Jan 2008 15:15 GMT
> Thanks, Mike ... this is exactly what I need, now I should be able to modify
> for the other numbers to divide by different amounts other than 25!
[quoted text clipped - 24 lines]
>
> >> I want the macro to see the .067 in the cell, and then in column four,
Your welcome

> >> divide the number found in column three by 25 and display number in
> >> column
[quoted text clipped - 9 lines]
>
> - Show quoted text -
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.