+ Reply to Thread
Results 1 to 10 of 10

IF OR THEN Formula

Hybrid View

  1. #1
    Registered User
    Join Date
    07-14-2013
    Location
    california
    MS-Off Ver
    Excel 2016
    Posts
    70

    IF OR THEN Formula

    Need to create a formula that looks for a word in a row and returns a value based on the word found.
    As an example:
    IF the word resistor is in any column in the row THEN assign a value of $100,
    OR IF the word capacitor is found in any column THEN assign a value of $150,
    OR IF the word transistor is found in the row THEN assign a value is $200

    Only one of the words would be in each row

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: IF OR THEN Formula

    =IF(COUNTIF(6:6,"resistor"),100,IF(COUNTIF(6:6,"capacitor"),150,IF(COUNTIF(6:6,"transistor"),200,"")))
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Registered User
    Join Date
    07-14-2013
    Location
    california
    MS-Off Ver
    Excel 2016
    Posts
    70

    Re: IF OR THEN Formula

    very cool Thanks

  4. #4
    Registered User
    Join Date
    07-14-2013
    Location
    california
    MS-Off Ver
    Excel 2016
    Posts
    70

    Re: IF OR THEN Formula

    Only problem is if the formula is placed in the same row as the word I get a circular reference error. Any way to modify so the formula is in the same row as the word?

  5. #5
    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 OR THEN Formula

    change then row ref to a range ref....6:6 to B6:E6 (aDJUST AS NEEDED)
    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

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

    Re: IF OR THEN Formula

    Here's another one:

    =SUM(COUNTIF(B2:D2,{"resistor","capacitor","transistor"})*{100,150,200})
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  7. #7
    Registered User
    Join Date
    07-14-2013
    Location
    california
    MS-Off Ver
    Excel 2016
    Posts
    70

    Re: IF OR THEN Formula

    thanks for the replies. I liked this one best

    =SUM(COUNTIF(B2:D2,{"resistor","capacitor","transistor"})*{100,150,200})

    Thanks again

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

    Re: IF OR THEN Formula

    You're welcome. Thanks for the feedback!

  9. #9
    Registered User
    Join Date
    07-14-2013
    Location
    california
    MS-Off Ver
    Excel 2016
    Posts
    70

    Re: IF OR THEN Formula

    Ho do I mark this as solved?

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

    Re: IF OR THEN Formula

    Immediately above the first post there is a menu bar.

    Select Thread Tools and there will be a selection to mark the thread as solved.

+ 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: 6
    Last Post: 10-08-2009, 03:45 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