+ Reply to Thread
Results 1 to 8 of 8

IF AND dilemma

  1. #1
    Registered User
    Join Date
    01-10-2015
    Location
    Silverado, CA
    MS-Off Ver
    Office 2010
    Posts
    5

    IF AND dilemma

    I've used PHP, but I'm not used to Excel for creating IF, AND, formulas. I work at a firm where we have several representatives who are licensed in specific states and in each state, there are different loans that we are assigned (based on how many representatives are licensed). Also in most states, there are no licensing guidelines, so everyone is eligible there.

    I tried doing a simpler formula because I know that I got multiple IF's working when I was just working with the account numbers (not dealing with the licensing states), but I can't seem to get the AND to play nice with IF:

    Please Login or Register  to view this content.
    This works fine. If the number is below 8, it shows Arnold, below 15, Alan, and so on.

    Please Login or Register  to view this content.
    This one is supposed to show 'Alan' when the state is IL and the account # is 00-49, also show 'Alan' if the state is AL and the account # is 34-44 and do the same for GA. If it's not any of those, it should show 'Not.'

    I'd like to eventually put every scenario in this formula. So if Bradshaw is licensed in OH and has accounts 35-40 there, I'd like his name to pop up.

    Please let me know what I'm doing wrong. Thanks.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,852

    Re: IF AND dilemma

    You need to note that those account numbers are text values (unless formatted to show in the form "00-00"), so you can't compare J2 directly with the first two numbers - you would need to do something like this:

    LEFT(J2,2)="00"

    If you want to treat them as numbers so that you can compare a range (as in your second IF), then you could do this:

    ... IF((AND(LEFT(J2,2)+0>=34,LEFT(J2,2)+0<=44,G2="AL"), "Alan", ...

    Adding a zero (or multiplying by 1) converts the text values into numbers.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    01-10-2015
    Location
    Silverado, CA
    MS-Off Ver
    Office 2010
    Posts
    5

    Re: IF AND dilemma

    Thanks Pete_UK. I already had that issue (and I believe it was resolved). I used the right function to pull out the last two digits but put the value function in front of it.
    Please Login or Register  to view this content.
    . There is something else with my code that I did wrong, but I can't figure it out.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,959

    Re: IF AND dilemma

    I think if you are dealing with text 00, then it might be best to leave it as text.
    Also, another way to "value" LEFT() is =--LEFT(A1,5)

    I think it would be best if you upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: IF AND dilemma

    Hi,

    As Ford has suggested it would be best if you uploaded your workbook. It may be that you could use a Pivot Table to analyse your data and avoid IF tests - even if it means adding a helper column or two to your data.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  6. #6
    Registered User
    Join Date
    01-10-2015
    Location
    Silverado, CA
    MS-Off Ver
    Office 2010
    Posts
    5

    Re: IF AND dilemma

    Attachment 369774 I've resolved the initial question. However, the problem is that the true situation is that AL, AR, FL, GA, IL, LA, MA, MI, MN, MS, NM, OH, SC, TX, UT, VT, WI, WV all require licensing and there are more like 10 employees that are licensed. This means that there would be more than 64 arguments (and it would be a mess). How would I take this simple IF AND formula and convert it to a pivot table? Here's the code that worked:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,852

    Re: IF AND dilemma

    Change your table in T2:X7 so that it only has the starting numbers of the range, i.e.:

    Alan........... ......0...... ........0
    Arnold........0....34...... ......21
    Bradshaw ..34....67..... .......41
    Cole..........67...... .....0......61
    David.......... ....... ..... .......81

    (that might not align completely correctly), and then you can use this formula in H3 (I put it in I3 so I could compare against your names):

    =INDEX($T$3:$T$7,MATCH(F3,INDEX($U$3:$X$7,0,IFERROR(MATCH(G3,$U$2:$W$2,0),4))))

    then copy down. It gives a different result on row 7, but I think Arnold is the correct answer.

    Hope this helps.

    Pete

  8. #8
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: IF AND dilemma

    Hi,

    See attached.

    The results in K3:K12 use the table called "tbl_states" on sheet1.
    Attached Files Attached Files

+ 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] Capacity dilemma
    By Aland2929 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-10-2012, 11:51 AM
  2. [SOLVED] Formula dilemma!
    By Cat A in forum Excel General
    Replies: 4
    Last Post: 04-01-2012, 10:14 AM
  3. Nth power dilemma
    By Andre Croteau in forum Excel General
    Replies: 6
    Last Post: 06-23-2006, 04:15 PM
  4. Do Until Loop Dilemma
    By mellowe in forum Excel General
    Replies: 2
    Last Post: 04-17-2006, 12:45 PM
  5. Autofill Dilemma
    By toby83 in forum Excel General
    Replies: 1
    Last Post: 01-23-2006, 09:15 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