IF D2 contains X then divide I2 by 10

Bassmoore

New Member
Joined
Jan 18, 2012
Messages
18
Hi All,

Have a major problem with our monthly call billing, we basically have a spreadsheet which shows a number called and the total cost of the call.

However our the calls for 0844 & 0845 numbers are 10x the actual cost!

Does anyone know how i can run a macro which will find the 0844 & 0845 numbers in the D column and then if it finds one, divides the total cost in column I by 10 on that particular row?


Thanks!
 
code would go something along the lines of

Dim c As Range, rng
Dim lastrow As Long
lastrow = Cells(Rows.Count, "d").End(xlUp).Row
Set rng = Range("d2:d" & lastrow)
For Each c In rng
If Left(c, 3) = "844" Then
c.Offset(0, 5).Value = c.Offset(0, 5).Value / 10
End If
Next c
 
Upvote 0

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
You mean you want to search for 0844 0845 and search for other numbers too?
Mmm, I wonder why you left that important information out?

If you only want to search for 0844 and 0845 other numbers will NOT be affected.
 
Upvote 0

Forum statistics

Threads
1,215,416
Messages
6,124,774
Members
449,187
Latest member
hermansoa

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