+ Reply to Thread
Results 1 to 7 of 7

Problem with a conditional "If" statement

  1. #1
    Registered User
    Join Date
    04-03-2014
    Location
    Woodbury, GA
    MS-Off Ver
    Excel 2010 and Excel 2013
    Posts
    37

    Unhappy Problem with a conditional "If" statement

    I'm writing a code to add the number of operations that are at each alarm point. However, the counter will not increment and the problem is either so simple I can't see it or I'm chasing the rabbit down the wrong the whole. Any and all help would be much obliged.

    Here's the code...
    Please Login or Register  to view this content.

    ... I would attach a spreadsheet but it seems that the uploading tool is not wanting to cooperate with my attempts.
    Last edited by EverGreen1231; 01-07-2016 at 02:07 PM.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Problem with a conditional "If" statement

    Lots of questions: What is AlarmPoint()? Should this be sheet specific? Should you be resetting NumOfNonLockout for each iteration of i? Do you really even need both loops? What is SubNames()? What is RowNumber_2?

    would be best if you could submit the sheet
    If you are happy with my response please click the * in the lower left of my post.

  3. #3
    Registered User
    Join Date
    04-03-2014
    Location
    Woodbury, GA
    MS-Off Ver
    Excel 2010 and Excel 2013
    Posts
    37

    Re: Problem with a conditional "If" statement

    Quote Originally Posted by stnkynts View Post
    Lots of questions: What is AlarmPoint()? Should this be sheet specific? Should you be resetting NumOfNonLockout for each iteration of i? Do you really even need both loops? What is SubNames()? What is RowNumber_2?

    would be best if you could submit the sheet
    Thank you for your reply.

    I'm sorry for the ambiguity. I'll see if I can get a comparable spreadsheet to upload. I've also tinkered with the script, but it still does not perform as I want. I'm over-looking something simple; that's always been the case when I've had these sort of problems.

  4. #4
    Registered User
    Join Date
    04-03-2014
    Location
    Woodbury, GA
    MS-Off Ver
    Excel 2010 and Excel 2013
    Posts
    37

    Re: Problem with a conditional "If" statement

    No luck with file uploading. I'm not sure why, but it simply wouldn't upload. I hope this representation is sufficient to clear any confusion.
    Please Login or Register  to view this content.
    It continues on similarly.

    My basic need is to find a cell that meets a certain string criterion ("Add Here", in this case). I then need it to find the next instance where that same string occurs and add the numbers that are within those limits: Meaning, in the above example, I want to add 89, 92, and 56 together and place that value into B1; then, add 24 and 12 and place that value in B5. I had thought to set dynamic upper and lower bounds in a for loop, but that didn't pan out.

    I then tinkered a little more and came up with the below code, but this doesn't produce anything of cause either; though, to me, it looked promising. ("DunDid" is an Ad Hoc value I was going to place in cell values if the code worked. It has no weight in the code.)
    Please Login or Register  to view this content.
    If anyone can see what I'm not seeing or has dealt with something similar to this before, any help you could give would be greatly appreciated.
    Last edited by EverGreen1231; 01-05-2016 at 12:27 PM.

  5. #5
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Problem with a conditional "If" statement

    Assuming you have a header row.

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Problem with a conditional "If" statement

    Does this help?

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-03-2014
    Location
    Woodbury, GA
    MS-Off Ver
    Excel 2010 and Excel 2013
    Posts
    37

    Re: Problem with a conditional "If" statement

    Quote Originally Posted by stnkynts View Post
    Assuming you have a header row.

    Please Login or Register  to view this content.
    Thank you! This works like a charm. I have much yet to learn, and you have taught me something: Thank you for that, as well.

    Quote Originally Posted by JOHN H. DAVIS View Post
    Does this help?

    Please Login or Register  to view this content.
    That is very close to one of the stages of code as it morphed from one problem to the next. Thank you for your response. Much obliged.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Using "IF" statement and conditional formatting on a Range of Cells
    By vincet2015 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-25-2015, 02:53 PM
  2. [SOLVED] IF Statement Evaluates as "TRUE" but Returns "FALSE" Value (Excel 2007)
    By Simcik in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-11-2014, 12:43 PM
  3. conditional formatting for if statement that returns "ok"
    By ammartino44 in forum Excel General
    Replies: 2
    Last Post: 01-02-2014, 04:56 PM
  4. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  5. How to leave cell empty with conditional statement (not "")
    By Coble in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 07-09-2012, 05:21 PM
  6. Nested "Data-> Valuation" within a conditional Statement
    By nosullivan in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-03-2007, 11:21 PM
  7. Replies: 3
    Last Post: 12-14-2006, 01:36 PM

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