Excel place a vaue in a cell if a number is in a certain range
Closed
rangebob
Posts
1
Registration date
Wednesday September 17, 2014
Status
Member
Last seen
September 17, 2014
-
Sep 17, 2014 at 12:17 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Sep 23, 2014 at 11:18 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Sep 23, 2014 at 11:18 AM
Related:
- Excel place a vaue in a cell if a number is in a certain range
- Number to words in excel - Guide
- Gif in excel - Guide
- Marksheet in excel - Guide
- How to take a screenshot in excel - Guide
- How to add 90 days to a date in excel - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Sep 23, 2014 at 11:18 AM
Sep 23, 2014 at 11:18 AM
Hi Rangebob,
Try the following code:
To use code:
From Excel hit Alt + F11 > top menu Insert > select Module > Paste code in big white field > close window > back at Excel hit Alt + F8 > double click RunMe.
Best regards,
Trowa
Try the following code:
Sub RunMe() For Each cell In Range(Range("A1"), Range("A" & Rows.Count).End(xlUp)) If cell >= 1 And cell <= 510 Then cell.Offset(0, 1) = 1 ElseIf cell >= 511 And cell <= 1020 Then cell.Offset(0, 1) = 2 ElseIf cell >= 1021 And cell <= 1530 Then cell.Offset(0, 1) = 3 ElseIf cell >= 1531 And cell <= 2040 Then cell.Offset(0, 1) = 4 ElseIf cell >= 2041 And cell <= 2550 Then cell.Offset(0, 1) = 5 End If Next cell End Sub
To use code:
From Excel hit Alt + F11 > top menu Insert > select Module > Paste code in big white field > close window > back at Excel hit Alt + F8 > double click RunMe.
Best regards,
Trowa