+ Reply to Thread
Results 1 to 3 of 3

Trying to avoid brute force with if statements

Hybrid View

  1. #1
    Registered User
    Join Date
    02-13-2019
    Location
    canada
    MS-Off Ver
    2010
    Posts
    56

    Trying to avoid brute force with if statements

    I am trying to avoid a 50ish if statement if possible.

    I have attached a sheet with a rough idea what I am trying to attempt. Basically what I am attempting is:
    Sheet1 - the data is just entered based on criteria from another sheet
    Sheet2 - Row20 data is copied from Sheet3!C3, Sheet3!D3 etc.
    Row21 is where the issues arises -
    Formula: copy to clipboard
    =if(Sheet2!B20=Sheet1!B5,Sheet1!B4,if(Sheet2!B20=Sheet1!C5,Sheet1!C4,if(Sheet2!B20=Sheet!1D5,Sheet1!D4 etc.)
    - This formula would then be copied across the page in the yellow cells.
    It becomes brute force because the sheet this will go into goes up to BJ4/BJ5.
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,777

    Re: Trying to avoid brute force with if statements

    Try this in column B then you can copy and paste it to all the other yellow cells.

    Formula: copy to clipboard
    =INDEX(Sheet1!$B$4:$BJ$4,1,MATCH(B20,Sheet1!$B$5:$BJ$5,0))


    The cells in Sheet2 row 20 must be formatted as General. Currently they are Text. As Text, they will not match the values on Sheet1.

  3. #3
    Registered User
    Join Date
    02-13-2019
    Location
    canada
    MS-Off Ver
    2010
    Posts
    56

    Re: Trying to avoid brute force with if statements

    Perfect, thank you, one of these days I will eventually learn how to use the Index and match.

+ 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. Replies: 3
    Last Post: 10-27-2016, 06:25 PM
  2. [SOLVED] Code for brute force
    By rize1159 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-12-2014, 01:06 PM
  3. Force destination formatting
    By krumel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-13-2013, 11:31 PM
  4. Replies: 12
    Last Post: 05-15-2009, 08:38 AM
  5. Can arrays be identified by i = X TO Y statements? (Avoid select Case)
    By macyarab in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-18-2009, 08:21 AM
  6. trying to avoid excessive concatenate statements
    By amh2190 in forum Excel General
    Replies: 7
    Last Post: 10-04-2007, 03:26 PM
  7. Looking for a way to avoid many If/Then statements
    By Paul987 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-06-2006, 04:30 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