PC Review


Reply
Thread Tools Rate Thread

Code to find specific number and calculate

 
 
Annette
Guest
Posts: n/a
 
      31st Jan 2008
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


 
Reply With Quote
 
 
 
 
Nigel
Guest
Posts: n/a
 
      31st Jan 2008
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.

--

Regards,
Nigel
(E-Mail Removed)



"Annette" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>


 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      31st Jan 2008
=IF(ISNUMBER(FIND(".067",A1)),C1/25,"")

--
---
HTH

Bob


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



"Annette" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      31st Jan 2008
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

"Annette" wrote:

> 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
>
>
>

 
Reply With Quote
 
Annette
Guest
Posts: n/a
 
      31st Jan 2008
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


"Mike H" <(E-Mail Removed)> wrote in message
news:A848CB35-D07E-413E-8995-(E-Mail Removed)...
> 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
>
> "Annette" wrote:
>
>> 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
>>
>>
>>



 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      31st Jan 2008
On Jan 31, 2:58*pm, "Annette" <she...@hotmail.com> wrote:
> 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
>
> "Mike H" <Mi...@discussions.microsoft.com> wrote in message
>
> news:A848CB35-D07E-413E-8995-(E-Mail Removed)...
>
>
>
> > 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

>
> > "Annette" wrote:

>
> >> 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,

Your welcome

> >> 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- Hide quoted text -

>
> - Show quoted text -


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate How the Number of Specific word. Khalid A. Al-Otaibi Microsoft Excel Misc 1 5th Apr 2010 07:53 AM
Find what numbers add up to a specific number heathersm1 Microsoft Excel Worksheet Functions 2 24th Mar 2009 06:07 PM
Calculate the number of days from a specific date Oceangate Microsoft Excel Misc 5 18th Nov 2008 01:42 AM
How to calculate number of occurencies of a specific number number Stefan Microsoft Excel Misc 4 8th Sep 2008 08:33 AM
How to Find a Specific First Number in a Row =?Utf-8?B?QWx0YUluZA==?= Microsoft Excel Misc 4 2nd Mar 2007 06:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:02 PM.