+ Reply to Thread
Results 1 to 3 of 3

VBA to eliminate nested IF function & provide result based on range

  1. #1
    Forum Contributor
    Join Date
    03-28-2008
    Location
    India, bangalore
    MS-Off Ver
    Excel 2003,2007
    Posts
    216

    VBA to eliminate nested IF function & provide result based on range

    Hi,

    Hope all had a nice week end.

    I have set of data for which I have to assign a value in Cold H based on a values from A to G. Using nested if function I am able get the result that I want .
    But, the conditions for If's and rows are going to get extended like 200k lines of data & conditions are going beyond 40 combinations.

    I thought of checking if there is a solution vba to do this function using conditions from another Range. I can create one mapping reference table & then VBA should pick up conditioons accordingly. In future, if conditions changes I can update on the "conditions" range and macro can pick them accordingly.
    (refer the image below, and also I attached the file for reference. )

    Mapping image.PNG

    Thanks in advance
    Regards
    Arvind
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    06-23-2021
    Location
    Romania
    MS-Off Ver
    2021, 365 v 2208
    Posts
    722

    Re: VBA to eliminate nested IF function & provide result based on range

    I don't think that is necessary to write a VBA code for that. You can use tha formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and press CTRL+SHIFT+Enter (is an array formula)
    The index-match combination is faster than IF or Vlookup

  3. #3
    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
    44,640

    Re: VBA to eliminate nested IF function & provide result based on range

    That formula works but needs to be modified for missing combinations:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The table also needs to be adjusted to remove the <> options.

    HTML Code: 
    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


+ 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] provide a range based on result
    By mufan in forum Excel General
    Replies: 2
    Last Post: 03-06-2019, 12:36 PM
  2. Trying to eliminate some nested if statements
    By Excelman0989 in forum Excel General
    Replies: 1
    Last Post: 07-27-2017, 07:35 AM
  3. Text queries within nested IF formulas to provide required output
    By marky385 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-14-2015, 05:06 AM
  4. compare totals and provide a result
    By Christopherdj in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-01-2012, 08:17 PM
  5. Eliminate the need for Nested Substitute
    By ElmerS in forum Excel General
    Replies: 3
    Last Post: 04-09-2010, 04:41 PM
  6. Function to compare multiple cells and provide a result
    By cfeedback in forum Excel General
    Replies: 3
    Last Post: 01-08-2010, 03:44 PM
  7. How do I Provide a specific result given multiple criteria?
    By Luis in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM

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