I need help with a Excel macro to create a column with information based on another column

Column A has the number of gallons that blood donors have given.  They range anywhere from 1-100. I would like a macro that takes that number, inserts a new column A and returns a value.  The value will be based on a number range. The returned value will be Bronze, Silver, Gold or Platinum.

1 thru 4      Bronze
5 thru 9      Silver
10 thru 14      Gold
15 thru 100       Platinum

Hope this makes sense.
gallon-certs-test.xls
Dan PurcellManagerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
Hi,

pls try

Sub Macro1()
    Columns("A:A").Insert Shift:=xlToRight
    Range("A1").FormulaR1C1 = "Rank"
    Range("A1").Font.Bold = True
    For Each c In Range(Range("B2"), Range("B2").End(xlDown)).Offset(, -1)
        Select Case c.Offset(, 1)
            Case 1 To 4
                c.Value = "Bronze"
            Case 5 To 9
                c.Value = "Silver"
            Case 10 To 14
                c.Value = "Gold"
            Case 15 To 100
                c.Value = "Platinum"
            Case Else
                c.Value = ""
        End Select
    Next

End Sub

Open in new window

Regards
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Evan CutlerVolunteer Chief Information OfficerCommented:
if you want to avoid macros altogether, you can do this:

=IF(AND(B1>=1,B1<=4),"Bronze",IF(AND(B1>=5,B1<=9),"Silver",IF(AND(B1>=10,B1<=19),"Gold","Platinum")))

Replace B1 with your cell.
Cheers,
0
Dan PurcellManagerAuthor Commented:
Thanks
0
Evan CutlerVolunteer Chief Information OfficerCommented:
update to match your specific handlers:

=IF(AND(B1>=1,B1<=4),"Bronze",IF(AND(B1>=5,B1<=9),"Silver",IF(AND(B1>=10,B1<=14),"Gold",IF(AND(B1>=15,B1<=100),"Platinum",""))))
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.