+ Reply to Thread
Results 1 to 9 of 9

IF-AND command with multiple arguments

  1. #1
    Registered User
    Join Date
    04-05-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    78

    IF-AND command with multiple arguments

    IF-AND command
    I have a numerical value in cell B1
    If value in B1 < = 5 then display “8SWG”
    If value in B1 > 5 but < 16 then display “12SWG”
    If value in B1 >= 16 but < =150 then display “25x3mm”
    If value in B1 >150 but < =200 then display “40x6mm”
    If value in B1> =200 then display “50x6mm”

    I tried with IF-AND, but it is returning the error “too many arguments”. Is there a command to do this?

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: IF-AND command with multiple arguments

    Try this

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: IF-AND command with multiple arguments

    As an alternative to the above LOOKUP you could use a nested IF with the values in descending order and it will accomplish the same thing. There is no real need to use AND in this instance.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Or, you could use a small table and use VLOOKUP.

    BSB

  4. #4
    Registered User
    Join Date
    04-05-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    78

    Re: IF-AND command with multiple arguments

    Thanks Alkey. This works fine.

  5. #5
    Registered User
    Join Date
    04-05-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    78

    Re: IF-AND command with multiple arguments

    Thanks Mr. BadlySpelledBuoy. Could you please give an indication on how to implement using vlookup. I tried using vlookup also. I felt vlookup would do. But i was confused how to add conditions. Can you give a hint on how to do it

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: IF-AND command with multiple arguments

    If you want to use VLOOKUP with lookup table

    Enter formula in C1

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


    v B C D E
    1 165 40x6mm 0 8SWG
    2 6 12SWG
    3 16 25x3mm
    4 151 40x6mm
    5 201 50x6mm

  7. #7
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: IF-AND command with multiple arguments

    Just for information. If you want to use IF and < instead of > this will work
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    You can use INDEX and MATCH instead of VLOOKUP
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    G
    H
    1
    0
    8SWG
    2
    6
    12SWG
    3
    16
    25x3mm
    4
    151
    40x6mm
    5
    201
    50x6mm
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  8. #8
    Registered User
    Join Date
    04-05-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    78

    Re: IF-AND command with multiple arguments

    Thanks once again Alkey for the demonstration of implementation using the command vlookup. It seems to be the professional approach to the problem. Learnt a new method of implementation.
    Thanks once again. This forum is great.

  9. #9
    Registered User
    Join Date
    04-05-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    78

    Re: IF-AND command with multiple arguments

    Thanks Mr. newdoverman. INDEX and MATCH obviates the need for entering the output column required as arguments. Unfortunately, INDEX-MATCH is not used too often in excel lookups. Since the data space is less here, we may well go for this as suggested by you. Of course, it is much professional than IF-AND command. Works perfect. Thanks and keep going.
    Last edited by melvinkoshy; 04-05-2016 at 09:26 PM.

+ 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. Code for a master command button to change the backcolor of multiple command buttons?
    By panttherm5 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-16-2012, 10:11 PM
  2. Replies: 4
    Last Post: 12-21-2011, 08:35 AM
  3. Multiple IF Arguments
    By Chris-TT in forum Excel General
    Replies: 6
    Last Post: 12-31-2010, 01:35 PM
  4. what are command line arguments to run macro invisibly? and 2 more questions
    By briana banks in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-30-2008, 09:45 AM
  5. command line arguments in excel
    By thepitzaboy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-03-2007, 02:34 AM
  6. [SOLVED] pass arguments to macro of excel file from command line
    By poli in forum Excel General
    Replies: 0
    Last Post: 02-03-2006, 06:20 AM
  7. Command Line Arguments
    By Joseph Hanna in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-13-2005, 10:05 PM
  8. [SOLVED] How can I start Excel 2000 with arguments from the command line?
    By sidibou in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-04-2005, 08:06 AM

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