Replace cell value

ava

New Member
Joined
Oct 23, 2007
Messages
7
I need to examine each cell value in column A and if the cell value is less than 5, I need to change the value in that cell to 5. If the cell value is greater than 5, then no change is required for that cell. Can someone please provide a solution or direct me to a post that has solved this problem. Thanks for your help.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Do you need to correct an existing worksheet, i.e. scanning all the data in col A and do the change, or you wish from now on to control what the user types in the cells?

Bye
 
Upvote 0
PHP:
Sub Five_or_more()
     Dim Lastrow as long, i as Long
     Lastrow = cells(rows.count, 1).end(xlup).row
     for i = 2 to LastRow
          If cells(1,i) < 5 then
               cells(1,i) = 5
          End If
     Next i
End Sub
 
Upvote 0
Welcome to the Board!

You can use =IF(A1<5,5,A1) copied down in another column.

Then you can can simply copy the formula range as values on top of the source range.

HTH,
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,275
Members
452,902
Latest member
Knuddeluff

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