Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Tiering Macro, Should be easy?

Hi I need to write a macro that I believe is pretty easy but I'm a
little rusty on my programming. Any help would be greatly appreciated.

I have a list like this:
name1 25
name2 50
name3 70
etc

I need to go down the numbers column (column B). If the number is
between 20 and 30, I want to insert ".1" in a third column on the
right. If the number is between 30 and 100, I want to insert ".2".
else, I want to insert "5".

Thanks in advance!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Tiering Macro, Should be easy?

Turn on the macro recorder (Tools | Macro Record new macro...),
select the first cell in column C with data in column B. Suppose it is
C1. Enter the untested formul
=IF(OR(B1<20,B1200),5,IF(B1<=30,0.1,0.2))
Move the mouse to the lower right corner of the cell (it will become a
black cross) and double-click. This will copy the formula as far down
column C as there is data in B.

If you don't want to leave the formula in place, select column C, copy,
right-click, select Paste Special... | Values.

Turn off the recorder and XL will give you the necessary code.

You may also want to see
Beyond Excel's recorder
http://www.tushar-
mehta.com/excel/vba/beyond_the_macro_recorder/index.htm#eg4

particular Example 4: Add a formula to a range of cells

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article .com,
says...
Hi I need to write a macro that I believe is pretty easy but I'm a
little rusty on my programming. Any help would be greatly appreciated.

I have a list like this:
name1 25
name2 50
name3 70
etc

I need to go down the numbers column (column B). If the number is
between 20 and 30, I want to insert ".1" in a third column on the
right. If the number is between 30 and 100, I want to insert ".2".
else, I want to insert "5".

Thanks in advance!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Tiering Macro, Should be easy?

Thanks for the reply. Unfortunately I need something more advanced. I
actually have 20 tiers to check against and I found that an if
statement can't be nested on so many levels. In addition, the list can
be up to 50,000 rows.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy macro issue (I think) punter Excel Discussion (Misc queries) 3 May 29th 06 03:17 PM
Macro Help, Real Easy comotoman Excel Discussion (Misc queries) 4 January 30th 06 03:43 PM
Macro for sheet delete, very easy comotoman Excel Discussion (Misc queries) 1 October 11th 05 11:19 PM
Easy Excel Macro? sva3 Excel Programming 1 August 19th 05 03:25 PM
VBA macro easy problem! Andrew Slentz Excel Programming 2 May 7th 04 06:39 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"