+ Reply to Thread
Results 1 to 9 of 9

Adding Values in Multiple Offset Cells depending on the value of a different cell

  1. #1
    Registered User
    Join Date
    08-19-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    62

    Adding Values in Multiple Offset Cells depending on the value of a different cell

    I'm a newbie struggling to figure out an excel macros code. Any help would be appreciated.

    I have attached a simple file to what I'm trying to do.
    File for excel forum.xlsx

    Column E: I have Company names (Grant's Inc., Bills Market, Sarah Bakery, Pete Diner, etc.)
    Column I : Will be a "Yes" or "No" answer (already entered)
    Column BD: Needs to have a number entered "0" or "1" depending on a reply box.
    Column BE: Needs to have a number entered "2" or "0" depending on a reply box.
    Column BF: Needs to have a number entered "0" or "1" depending on a reply box.

    *All data starts at row 8.

    I basically want to make some loops to add scores to the 3 columns BD,BE,BF.
    Which give Grant's Inc. a score in cell BD8.
    Next, give Bill's Market a score in cell BD9.
    Next, give Sarah Bakery a score in cell BD10.
    Next, give Pete Diner a score in cell BD11.
    etc. until column I shows a "No" answer for a company.

    After Column I shows a "No" answer, I will end that loop and go back up to row 8 with Grant's Inc. and start giving scores in BE8 depending on a reply box.
    (but I will only give scores in BE if there is a "1" value in BD.

    I will continue a loop to score all Companies in Column BE if they have a "1" score in Column BD.
    After I have no more scores of "1" in BD, then I will end the loop and go back up to row 8 with Grant's Inc. and start giving scores in BF8 depending on a reply box.
    ...and so on...


    Here's my bad attempt at a code so far:


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Adding Values in Multiple Offset Cells depending on the value of a different cell

    Please Login or Register  to view this content.
    you can continue adding other questions

  3. #3
    Registered User
    Join Date
    08-19-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Adding Values in Multiple Offset Cells depending on the value of a different cell

    Patel45,
    Thank you! It worked perfectly. I just had to change the arow 8 (since my data started at row 8).

    I still need a few more things that I'm not sure how to do.

    After I ask "Do you know this company?" for all the companies in Column E, if the user answers "No" to all companies and the scores are all "0" in column BD, then I want this message to pop up and to exit the sub.

    Here's the message:
    "We couldn't recommend your investing in any of the companies."

    I tried this, but it didn't work:

    Please Login or Register  to view this content.
    Last edited by lottidotti; 08-20-2012 at 06:30 AM. Reason: Removed double post

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Adding Values in Multiple Offset Cells depending on the value of a different cell

    On my file no problem, attach please your file

  5. #5
    Registered User
    Join Date
    08-19-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Adding Values in Multiple Offset Cells depending on the value of a different cell

    Hi Patel45,

    Everything that you wrote works. But I tried to add this code and it didn't work:

    Please Login or Register  to view this content.
    What is the correct way to write a code for :
    If the sum of BD8 to BD arow is less than 1, then show message.

  6. #6
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Adding Values in Multiple Offset Cells depending on the value of a different cell

    If WorksheetFunction.Sum(Range(Cells(8,56),(arow, 56))) < 1 Then

  7. #7
    Registered User
    Join Date
    08-19-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Adding Values in Multiple Offset Cells depending on the value of a different cell

    Thanks Patel45,
    But for some reason it came up as Compile Error: Syntax Error

  8. #8
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Adding Values in Multiple Offset Cells depending on the value of a different cell

    If WorksheetFunction.Sum(Range(Cells(8,56),Cells(arow, 56))) < 1 Then

  9. #9
    Registered User
    Join Date
    08-19-2012
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Adding Values in Multiple Offset Cells depending on the value of a different cell

    Worked Perfectly! Thanks for all your help Patel45!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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