+ Reply to Thread
Results 1 to 14 of 14

Formula to return specified value based on criteria

  1. #1
    Registered User
    Join Date
    09-06-2014
    Location
    usa
    MS-Off Ver
    2013
    Posts
    12

    Formula to return specified value based on criteria

    Hello guys, i need a lil help. I'm trying to do a formula that shows a value based on text.
    for ex: if cell a1 contains word "three" then show value 3

    is there any way to do that. thanks

  2. #2
    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
    53,049

    Re: Formula to return specified value based on criteria

    Maybe this...
    =if(A1="Three",3,"")

    If you have more than just a few criteria, it will probably be better to create a small table with the criteria/values, then use VLOOKUP()
    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

  3. #3
    Registered User
    Join Date
    09-06-2014
    Location
    usa
    MS-Off Ver
    2013
    Posts
    12

    Re: Formula to return specified value based on criteria

    thanks... its just a little table that I'm trying to create... that will work perfectly.. thanks a lot.

  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
    53,049

    Re: Formula to return specified value based on criteria

    OK cool, glad to help

    If this answered your question, please take a moment to mark the thread as "solved" - it helps keep things neat and tidy lol, and consider adding the reputation to those that helped (see points 2 & 3 below my 1st post to you)

  5. #5
    Registered User
    Join Date
    09-06-2014
    Location
    usa
    MS-Off Ver
    2013
    Posts
    12

    Re: Formula to return specified value based on criteria

    OK!!!. i think i need a lil more help. i don't ask the correct question. lol.
    its a count formula that i need.
    for ex.
    if a1 contains "three" then count 3 but if contains "two" count 2

    thats what I'm trying to do.


    sorry for my ignorance.

  6. #6
    Registered User
    Join Date
    09-06-2014
    Location
    usa
    MS-Off Ver
    2013
    Posts
    12

    Re: Formula to return specified value based on criteria

    IM DOING THIS =IF(A1:A10="THREE",3"")
    the formula gives me a value error

  7. #7
    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
    53,049

    Re: Formula to return specified value based on criteria

    I think this is probably a bit more complex that you are trying to make it. What exactly are you doing? (sometimes, when trying to simplify an example, it ends up missing the point)

    If it's just those 2, then maybe...

    =IF(countif(A1:A10,"Three")=3,3,IF(countif(A1:A10,"Two")=2,2,""))

  8. #8
    Registered User
    Join Date
    09-06-2014
    Location
    usa
    MS-Off Ver
    2013
    Posts
    12

    Re: Formula to return specified value based on criteria

    OK, I'm trying to do a counter of lines of business sold, saying that TP is equal to 3 lob's, DP is 2 and SP is 1
    i'm trying to get something we call "RGU" which is the percentage of the total amount of LOB divided by the total amount of calls that we get. i work for a call center.

    the formula you gave me it doesn't give me any error but i doesn't show any value . i did =IF(countif(A1:A10,"Three")=3,3,&IF(countif(A1:A10,"Two")=2,2,""))

    then it gives me a crazy error that close my excel. some how.

  9. #9
    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
    53,049

    Re: Formula to return specified value based on criteria

    you have an & sign in there that should not be there
    =IF(countif(A1:A10,"Three")=3,3,&IF(countif(A1:A10,"Two")=2,2,""))

  10. #10
    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
    53,049

    Re: Formula to return specified value based on criteria

    hmm wait. So you are trying to get the sum of all TP's + all DP's + all SP's?

    If so, then try this...
    =SUM(COUNTIF(A1:A1000,{"TP","DP",SP}))

  11. #11
    Registered User
    Join Date
    09-06-2014
    Location
    usa
    MS-Off Ver
    2013
    Posts
    12

    Re: Formula to return specified value based on criteria

    got it. but were should i put the value of does occurrences TP= 3, DP=2 and SP=1? at the end of the occurrence right?

  12. #12
    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
    53,049

    Re: Formula to return specified value based on criteria

    LOL sorry, forgot about that part

    =SUM(COUNTIF(A1:A1000,"TP")*3,COUNTIF(A1:A1000,"DP")*2,COUNTIF(A1:A1000,SP))

  13. #13
    Registered User
    Join Date
    09-06-2014
    Location
    usa
    MS-Off Ver
    2013
    Posts
    12

    Re: Formula to return specified value based on criteria

    AWESOME!!! Works perfectly. thanks a lot!!!!

    the last part of the formula was missing the 'sp')*1 but i fix it already. wow. that was a pain in the pain. lol. i didn't know how to formulate that. thanks.!!

  14. #14
    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
    53,049

    Re: Formula to return specified value based on criteria

    oops sorry for the missing "", glad you caught that (my excuse is that its late here lol)

    If this answered your question, please take a moment to mark the thread as "solved" - it helps keep things neat and tidy lol, and consider adding the reputation to those that helped (see points 2 & 3 below my 1st post to 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. Formula to return specified value based on criteria
    By adriam25 in forum Excel General
    Replies: 8
    Last Post: 09-07-2014, 06:21 AM
  2. [SOLVED] Search and return value based on 3 criteria (array formula?)
    By AL1976 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-03-2014, 10:49 AM
  3. Array formula to return multiple values based on various (OR) criteria
    By dancing-shadow in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-20-2013, 05:12 AM
  4. [SOLVED] Formula to Return ID based on Multiple Criteria
    By boldcode in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-09-2013, 02:54 PM
  5. Formula to search and return cell based on criteria not working
    By DifferentFrogs in forum Excel General
    Replies: 9
    Last Post: 03-21-2012, 10:48 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