+ Reply to Thread
Results 1 to 9 of 9

Logical expression with two conditions.

  1. #1
    Forum Contributor
    Join Date
    03-05-2018
    Location
    Tbilisi, Georgia
    MS-Off Ver
    2013, 2016
    Posts
    271

    Logical expression with two conditions.

    Hi experts,

    I have a calculation sheet (attached). In E column formula determines the volume of bottles and returns respective value:

    For example in column C volume: 250 ml = 20 pcs, 330 = 20 pcs, 1L = 12 pcs and etc. Also formula detects if there is no space between value and letters in C cells and returns the right value anyway.

    But, sometimes I need volumes to return different values according to condition in cell A1.

    For example if A1=UK then 250 ml = 12 pcs, and the other values should remain untouched, but if A1=US then 250 ml = 20 pcs. Is it possible to modify this formula?
    Please advise.


    Also, in column G I have a formula that works. It returns respective dimensions of the Cases according to the values from C and E columns. Is it possible to make it shorter somehow?
    Thank you.
    Attached Files Attached Files

  2. #2
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Logical expression with two conditions.

    Try this formula in E2

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

    "1L",12,8 means that 1 L is 12 pcs for US and 20 for UK

  3. #3
    Forum Contributor
    Join Date
    03-05-2018
    Location
    Tbilisi, Georgia
    MS-Off Ver
    2013, 2016
    Posts
    271

    Re: Logical expression with two conditions.

    Quote Originally Posted by José Augusto View Post
    Try this formula in E2

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

    "1L",12,8 means that 1 L is 12 pcs for US and 20 for UK
    Great! Thank you so much.

  4. #4
    Forum Contributor
    Join Date
    03-05-2018
    Location
    Tbilisi, Georgia
    MS-Off Ver
    2013, 2016
    Posts
    271

    Re: Logical expression with two conditions.

    Could you also advise about second formula in G column. It works, but I suspect it could be much more shorter:

    Please Login or Register  to view this content.

  5. #5
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Logical expression with two conditions.

    Please try at

    E2
    =LOOKUP(-LOOKUP(,-(0&LEFT(C2,{1,2,3,4}))),{0,1,250,330},IF($A$1="us",{"",12,20,20},{"",12,12,20}))

    G2
    =IF(C2="","",IF(C2="1L","39X30X26",IF(C2="250 ml",IF(E2=20,"29X23X15","36X28X20"),"33X26X18")))

  6. #6
    Forum Contributor
    Join Date
    03-05-2018
    Location
    Tbilisi, Georgia
    MS-Off Ver
    2013, 2016
    Posts
    271

    Re: Logical expression with two conditions.

    Quote Originally Posted by Bo_Ry View Post
    Please try at

    E2
    =LOOKUP(-LOOKUP(,-(0&LEFT(C2,{1,2,3,4}))),{0,1,250,330},IF($A$1="us",{"",12,20,20},{"",12,12,20}))

    G2
    =IF(C2="","",IF(C2="1L","39X30X26",IF(C2="250 ml",IF(E2=20,"29X23X15","36X28X20"),"33X26X18")))
    Absolutely superb! Many many thanks!

  7. #7
    Forum Contributor
    Join Date
    03-05-2018
    Location
    Tbilisi, Georgia
    MS-Off Ver
    2013, 2016
    Posts
    271

    Re: Logical expression with two conditions.

    Quote Originally Posted by José Augusto View Post
    Try this formula in E2

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

    "1L",12,8 means that 1 L is 12 pcs for US and 20 for UK
    Hi Jose, For some reasons I need to add to this formula 30 gr condition (marked in red)
    =IF(TRIM(C2)<>C2,"Error",VLOOKUP(SUBSTITUTE(C2," ",""),{"","","";"1 L",12,8;"250ML",20,12;"330ML",20,12;"370gr",20,12;"30gr",40,40},2+(UPPER($A$1)="UK"),1))
    But it doesn't work. Can you advise?

  8. #8
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Logical expression with two conditions.

    Try this
    =IF(TRIM(C2)<>C2,"Error",VLOOKUP(SUBSTITUTE(C2," ",""),{"","","";"1 L",12,8;"250ML",20,12;"330ML",20,12;"370gr",20,12;"30gr",40,40},2+(UPPER($A$1)="UK"),0))

  9. #9
    Forum Contributor
    Join Date
    03-05-2018
    Location
    Tbilisi, Georgia
    MS-Off Ver
    2013, 2016
    Posts
    271

    Re: Logical expression with two conditions.

    Great and in fact so simple Thank you.

+ 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] A simple logical expression that I can't figure out
    By Trebor777 in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 01-15-2017, 11:27 PM
  2. Nested Vlookups with logical (OR) expression
    By AndyinAus in forum Excel General
    Replies: 7
    Last Post: 11-28-2016, 08:26 PM
  3. Avoid repeating inner equation in a logical expression
    By michellepace in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-19-2016, 11:19 AM
  4. [SOLVED] Logical Expression Question
    By wz4np1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-13-2012, 10:00 AM
  5. Replies: 1
    Last Post: 06-05-2008, 12:55 AM
  6. Logical Expression For MULTIPLE Cells???
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-22-2005, 07:10 PM
  7. Replies: 2
    Last Post: 12-05-2005, 06:15 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