+ Reply to Thread
Results 1 to 5 of 5

Need to get values based on multiple conditions through Macro

  1. #1
    Registered User
    Join Date
    06-10-2023
    Location
    Mumbai India
    MS-Off Ver
    2019
    Posts
    21

    Need to get values based on multiple conditions through Macro

    So far my code is working OK however I dont seem to be getting desired values since all the values are dynamic and change from time to time, hence the need for change, I need to embed this in my code, I have no idea how to acheive it. I need these values only when column D & J is clicked.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Current Code in use which doesnt give desired values:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by mahmad558; 06-16-2023 at 10:30 AM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,153

    Re: Need to get values based on multiple conditions through Macro

    This formula won't work for two reasons

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    1. The first line of the formula refers to G7, not G47

    2. If a value is less than 30, it will also be less than all the higher test values that precede it. So the formula will return the <=90 result. You need to reverse the order of the tests.

    The second formula also has the same issue (2).
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    06-10-2023
    Location
    Mumbai India
    MS-Off Ver
    2019
    Posts
    21

    Re: Need to get values based on multiple conditions through Macro

    The point here is to embed the code and this is for the entire column range G4 : G76 , A4 : A76 , F4 to F76, H4 : H76, M4 : M76
    the <= sign can be changed to >= depedning on the result I get.
    ***Corrections***

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by mahmad558; 06-16-2023 at 08:17 AM.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,153

    Re: Need to get values based on multiple conditions through Macro

    I'm not going to spend any time embedding a formula in code when I know it won't work.


    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file and a mocked up solution.

  5. #5
    Registered User
    Join Date
    06-10-2023
    Location
    Mumbai India
    MS-Off Ver
    2019
    Posts
    21

    Re: Need to get values based on multiple conditions through Macro

    Have uploaded the file for your reference, the idea is that when I click on Column J or Column D, I need this calculation, which you can see in column N & O, this value should display in Cell A3 when column D is clicked and in M3 when Column J is clicked.

    Instead of using <= I have used >=, I have corrected that.

+ 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. [SOLVED] Looking up values based on multiple conditions then put sum the values in anther sheet.
    By cuchi33 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-05-2017, 11:35 AM
  2. Replies: 1
    Last Post: 10-01-2013, 02:41 AM
  3. Replies: 5
    Last Post: 09-25-2013, 12:31 AM
  4. [SOLVED] Formula to get look up values based on multiple conditions
    By Excel Dumbo in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-29-2013, 12:17 AM
  5. [SOLVED] Trying to add conditioning and values based on multiple conditions.
    By SadenShard in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-27-2011, 12:58 AM
  6. Insert multiple values from seperate table based on multiple conditions
    By drakesong in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-28-2011, 06:04 PM
  7. Calculate Values based on Multiple Conditions
    By creativefusion in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 05-24-2009, 09:27 PM

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