+ Reply to Thread
Results 1 to 2 of 2

Macro needed to add values to a cell in excel IF(condition)

  1. #1
    Registered User
    Join Date
    11-17-2009
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    1

    Macro needed to add values to a cell in excel IF(condition)

    Hi all,

    I have created an Excel files with several macros in it, but this one got me puzzled.

    There are two columns and about 70 rows in the file. Column A contains dollar values and column B contains number of units. There are three types of units: a, b, c. Unit a costs 21, unit b costs 31, unit c costs 50. So the idea is to extract how many a, b and c units there are in the rows.

    The way I want to do is to:

    IF(C2/21=E2, ADD E2 to E76), IF(C2/31=E2, ADD E2 to E77), IF(C2/50=E2, ADD E2 to E78)

    The macro will need to do the above for each row

    I cant however figure how to make it go through all rows and also how to make it add to the existing cell

    Any help is appreciated

    Thanks!
    Last edited by netrisca; 11-17-2009 at 01:38 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Trying to come up with a macro

    Welcome to the forum,

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1