+ Reply to Thread
Results 1 to 10 of 10

Use the IF Function for a range cells

Hybrid View

delroba Use the IF Function for a... 02-01-2015, 01:38 AM
FDibbins Re: Use the IF Function for a... 02-01-2015, 01:46 AM
delroba Re: Use the IF Function for a... 02-01-2015, 02:11 AM
Tony Valko Re: Use the IF Function for a... 02-01-2015, 11:43 AM
delroba Re: Use the IF Function for a... 02-03-2015, 02:50 AM
Tony Valko Re: Use the IF Function for a... 02-03-2015, 08:43 PM
FDibbins Re: Use the IF Function for a... 02-01-2015, 02:12 AM
FDibbins Re: Use the IF Function for a... 02-01-2015, 12:46 PM
  1. #1
    Registered User
    Join Date
    03-14-2014
    Location
    Iran, Ahvaz
    MS-Off Ver
    Excel 2007-2010-2013
    Posts
    12

    Use the IF Function for a range cells

    Dear all,
    i want use the IF Function for a range cells like below table but i think it doesn't work

    {=IF(AND(A1:A8>100),"Not Ok","Ok") } -----> Ok
    {=IF(COUNTIF(A1:A8,AND(A1:A8>100))>0,"Not Ok","Ok") } -----> Ok

    table.JPG

    Thank's

  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,048

    Re: Use the IF Function for a range cells

    You cannot use a range like that in an IF statement. Try something like this instead...

    =if(COUNTIF(A1:A8,">100")>0,"Not Ok",""OK")
    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
    03-14-2014
    Location
    Iran, Ahvaz
    MS-Off Ver
    Excel 2007-2010-2013
    Posts
    12

    Re: Use the IF Function for a range cells

    its solved
    Thanks a lot

  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: Use the IF Function for a range cells

    Quote Originally Posted by FDibbins View Post
    You cannot use a range like that in an IF statement.
    You can if you enter the formula as an array formula**.

    =IF(AND(A1:A8>100),"Not Ok","Ok")

    Every cell in the range must meet the condition to evaluate as TRUE.

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    03-14-2014
    Location
    Iran, Ahvaz
    MS-Off Ver
    Excel 2007-2010-2013
    Posts
    12

    Re: Use the IF Function for a range cells

    Quote Originally Posted by Tony Valko View Post
    You can if you enter the formula as an array formula**.

    =IF(AND(A1:A8>100),"Not Ok","Ok")

    Every cell in the range must meet the condition to evaluate as TRUE.

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    But its not work even after press the CTRL,SHIFT,ENTER
    {=IF(AND(A1:A8>100),"Not OK","OK")}

    the answer is ok either below 100 or not.
    why this happened ?

  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: Use the IF Function for a range cells

    {=IF(AND(A1:A8>100),"Not OK","OK")}
    If EVERY cell in the range A1:A8 is greater than 100 then that ARRAY formula should return "Not OK".

    If ANY cell in the range A1:A8 is less than or equal to 100 then that ARRAY formula should return "OK".

  7. #7
    Registered User
    Join Date
    03-14-2014
    Location
    Iran, Ahvaz
    MS-Off Ver
    Excel 2007-2010-2013
    Posts
    12

    Re: Use the IF Function for a range cells

    I got it
    thanks

  8. #8
    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,048

    Re: Use the IF Function for a range cells

    Happy to help, thanks for he feedback

  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,048

    Re: Use the IF Function for a range cells

    oops thanks for the catch, Tony, I meant to include that, but got side-tracked

+ 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] If function with range of cells
    By sanlen in forum Excel General
    Replies: 6
    Last Post: 10-13-2014, 11:37 PM
  2. Replies: 3
    Last Post: 10-25-2012, 05:47 PM
  3. Cells function within a range
    By therealjag in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-16-2009, 07:59 AM
  4. SUM function to be used for a range of cells
    By Ranjani in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-31-2009, 11:16 AM
  5. IF function with a range of cells
    By chubbycheese in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-24-2008, 05:20 PM

Tags for this Thread

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