+ Reply to Thread
Results 1 to 9 of 9

If/Then Formula Question

Hybrid View

  1. #1
    Registered User
    Join Date
    12-28-2016
    Location
    Cleveland, Ohio
    MS-Off Ver
    Excel 2013
    Posts
    3

    If/Then Formula Question

    Hello I am looking for help writing an IF Then Formula. I am putting together a 3D Printing Cost Recording Sheet. Basically what I want is to type the specific material in one column (such as PLA or ABS), type the weight of the material in another column, and have another column multiply the weight by the Unit weight (this unit weight will not be shown in the excel sheet). There will be 5 materials with 5 unique price per gram numbers. Can anyone help me with this?

    Here is an example.
    Material Weight Cost
    PLA 23g (Need This) The price per gram for PLA is 0.0666/gram. The weight will end up being (23*0.0666). I need the formula to do this automatically for me when I type in PLA. If I were to type NYLON instead of
    PLA, it should be (23*0.093).

  2. #2
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    906

    Re: If/Then Formula Question

    Assuming your price in column B below is the formula.

    =IF(A1="PAL",B1*0.0666,B1*0.093)

  3. #3
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: If/Then Formula Question

    You should be using VLOOKUP rather than IF statements.

    Create a table somewhere in your workbook containing the Material and weight cost (make sure its in alphabetical order). Then give the table a name (Ive used "Materials" in the example).

    Then use VLOOKUP as per the example below

    Assuming you enter the code in A1, the Weight in B1 and have the answer in C1 then enter the following in C1

    =VLOOKUP(A1,materials,2,FALSE)*B1
    More on VLOOKUP > https://support.office.com/en-gb/art...8-93a18ad188a1
    Attached Files Attached Files
    If someone has helped you then please add to their Reputation

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If/Then Formula Question

    Quote Originally Posted by guywithquestion View Post
    this unit weight will not be shown in the excel sheet
    If not in a table on a sheet it will still be in the formulas.

    Need more clarification.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    12-28-2016
    Location
    Cleveland, Ohio
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: If/Then Formula Question

    Quote Originally Posted by Tony Valko View Post
    If not in a table on a sheet it will still be in the formulas.

    Need more clarification.
    I wanted to have the unit prices in the formula and not in a table on a page. That is all I meant.

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

    Re: If/Then Formula Question

    Just a slight change to Richard's formula:

    =LOOKUP(A2,{"Nylon","PLA"},{0.093,0.066})*B2

    The items in the first array list need to be in alphabetical order (and the items in the second list need to correspond with those in the first list).

    Hope this helps.

    Pete

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If/Then Formula Question

    Quote Originally Posted by Pete_UK View Post
    Just a slight change to Richard's formula:

    =LOOKUP(A2,{"Nylon","PLA"},{0.093,0.066})*B2
    If B2 contains 23g then you have to account for the "g".

  8. #8
    Registered User
    Join Date
    12-28-2016
    Location
    Cleveland, Ohio
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: If/Then Formula Question

    Pete's Response was exactly what I needed. Thanks for the timely responses everyone.

  9. #9
    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/Then Formula Question

    Hi,

    With your Material in A2 (and this could be data validation drop down cell allowing you to pick one of the 5 materials), and the weight in B2 then in C2 the cost function will be

    Formula: copy to clipboard
    =LOOKUP(A2,{"PLA","Nylon"},{0.066,0.093})*B2


    obviously extend the two array elements for your other three materials.
    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.

+ 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: 1
    Last Post: 03-04-2012, 12:03 AM
  2. Replies: 2
    Last Post: 10-08-2009, 09:51 PM
  3. Replies: 1
    Last Post: 05-20-2009, 08:15 AM
  4. Replies: 1
    Last Post: 05-20-2009, 07:56 AM
  5. [SOLVED] Formula question-change formula based cell calling it?
    By seethesun in forum Excel General
    Replies: 2
    Last Post: 02-08-2009, 01:39 PM
  6. Formula question-formula to subtract multiple cells
    By arrchapman in forum Excel General
    Replies: 3
    Last Post: 04-17-2008, 04:13 AM
  7. [SOLVED] Newbie Question - Subtraction Formula Question
    By admiral_victory@iol.ie in forum Excel General
    Replies: 3
    Last Post: 05-05-2006, 12:55 PM
  8. IF formula question:edit the fist half of the original formula
    By impress in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-13-2006, 08:35 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