+ Reply to Thread
Results 1 to 6 of 6

Newbie help with "if"

  1. #1
    Registered User
    Join Date
    11-13-2015
    Location
    Gothenbirg
    MS-Off Ver
    2016
    Posts
    7

    Newbie help with "if"

    Hi,

    I'm attempting to use "IF" (or any other function that might work better) to do the following:

    Check if number "1" exist in the field range A1-A5, if it does calculate B1-B5/C1-C5. If another number then do nothing
    Then on the next row I will do the same but for number 2, and then number 3.


    So, I want it do check a number of field if a specific number exist. If it does, do this calculation. If not do nothing because the calculation will be made on the next or the last row instead (2 or 3). Something like this:

    A1:1
    A2:2
    A3:1
    A4:2
    A5:3
    B1: 20
    B2: 25
    B3: 30
    B4: 40
    B5: 20
    C1: 100
    C2: 200
    C3: 150
    C4: 200
    C5: 100

    If 1 = (20+30) / (100+150)
    If 2 = (25+40) / (200+200)
    If 3 = (30) / (150)

    Thanks in advance.

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Newbie help with "if"

    The formula is

    =SUMIF(A1:$A$5,1,$B1:$B5)/SUMIF($A$1:A5,1,$C$1:$C$5)


    Amend the 1 to 2 or 3 for your other rows


    Hiding the value if nothing can be done by wrapping in IFERROR

    =IFERROR(SUMIF(A1:$A$5,1,B1:B5)/SUMIF($A$1:A5,1,$C$1:$C$5),"")

    which works because formula will divide by 0 if there are not items in the range


    EDIT
    I amended the 2nd formula when I spotted the divide by zero option
    Last edited by kev_; 03-12-2018 at 07:36 AM.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  3. #3
    Registered User
    Join Date
    11-13-2015
    Location
    Gothenbirg
    MS-Off Ver
    2016
    Posts
    7

    Re: Newbie help with "if"

    Thanks! But it seems like I keep getting a excel error regarding the formula? "There is a problem with this formula" , strange? Can't even add it to a new, empty sheet.

  4. #4
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Newbie help with "if"

    open workbook
    look in column E
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Newbie help with "if"

    =IFERROR(SUMIF(A1:$A$5,1,B1:B5)/SUMIF($A$1:A5,1,$C$1:$C$5),"") works but you may wish to add $ to keep the ranges the same size

    =IFERROR(SUMIF($A$1:$A$5,1,$B$1:$B$5)/SUMIF($A$1:$A$5,1,$C$1:$C$5),"")

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Newbie help with "if"

    Administrative Note:
    • We would love to continue to help you with your query, but first, before we can proceed…
    • Please see Forum Rule #1 about proper thread titles and adjust accordingly...
    HTH
    Regards, Jeff

+ 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: 5
    Last Post: 02-05-2019, 12:03 AM
  2. Replies: 2
    Last Post: 07-24-2017, 02:19 AM
  3. [SOLVED] Column X-Ref list - Sheet1 Col A "pages", Col B:FL "Req" to Sheet2 ColA "req", ColB "page"
    By excel-card-pulled in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-07-2017, 09:30 AM
  4. [SOLVED] Newbie Needs "If greater than, but less than" statement" Formula Help
    By markpmcgregor in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-08-2017, 05:19 PM
  5. [SOLVED] newbie using lots of nested "if"s and"and"s. Parenthesis problems?
    By thnkfree in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-14-2014, 08:17 PM
  6. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  7. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 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