Please help with formula
Find bottlenecks in your Excel workbooks
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Please help with formula

  1. #1
    New Member
    Join Date
    Feb 2002
    Location
    Lithuania
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    I need C1 to return one of four values depending on condition in A1:B1
    IF A1=A and B1=B than C1=17
    IF A1=A and B1=C than C1=20
    IF A1=D and B1=B than C1=25
    IF A1=D and B1=C than C1=28

    What formula or code should I use?
    Can anybody help. Thanks in advance.


  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Sunny, spring-like Hull
    Posts
    3,339
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Well, the following seems to work OK, but I'm sure there's a better way of doing it; it's also case insensitive: -

    =IF(AND(A1="A",B1="B"),17,IF(AND(A1="A",B1="C"),20,IF(AND(A1="D",B1="B"),25,IF(AND(A1="D",B1="C"),28,""))))

  3. #3
    MrExcel MVP Aladin Akyurek's Avatar
    Join Date
    Feb 2002
    Location
    The Hague, NL
    Posts
    81,827
    Post Thanks / Like
    Mentioned
    12 Post(s)
    Tagged
    1 Thread(s)

    Default

      
    On 2002-03-14 00:38, Vitas wrote:
    I need C1 to return one of four values depending on condition in A1:B1
    IF A1=A and B1=B than C1=17
    IF A1=A and B1=C than C1=20
    IF A1=D and B1=B than C1=25
    IF A1=D and B1=C than C1=28

    What formula or code should I use?
    Can anybody help. Thanks in advance.
    Vitas,

    =IF(AND(OR(A1={"A","D"}),OR(B1={"B","C"})),VLOOKUP(A1&B1,{"AB",17;"AC",20;"DB",25;"DC",28},2,0),0)

    This formula returns zero if A1 and B1 do not have expected values.

    Aladin

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com