+ Reply to Thread
Results 1 to 13 of 13

Formula for using value in one column if value in another is zero

  1. #1
    Registered User
    Join Date
    08-20-2016
    Location
    Auckland, New Zealand
    MS-Off Ver
    Mac 2011
    Posts
    7

    Question Formula for using value in one column if value in another is zero

    Hi all, I hope I'm not insulting anyone's intelligence by even asking this question I suspect the solution is screamingly obvious but I can't work it out so would be so grateful for any help you can provide.

    I am working on a budget and different items are coded differently, for example all the security costs are coded "6516'. In column F is the amount of money that I have estimated the cost will be and issued a purchase order for. In column G is the actual amount that was invoiced. I'm now doing a column of estimated final costs that shows the actual costs incurred where possible but, when invoices haven't come in, shows the amount in the purchase order column (ie column G).

    So I need the formula to calculate "where an item is coded 6516 (for example) take the amount in column F, unless that amount is zero, in which case take the amount in column G".

    I hope I explained that clearly - apologies if not!!

    Again - thanks so much for any help people can give me.

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

    Re: Formula for using value in one column if value in another is zero

    I think we'll need to see some sample data.

    Can you post a SMALL sample file and show us what results you expect?

    20 rows worth of data is plenty.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    08-20-2016
    Location
    Auckland, New Zealand
    MS-Off Ver
    Mac 2011
    Posts
    7

    Re: Formula for using value in one column if value in another is zero

    Sure thing - I will try and post below..

    As you'll see, the PO (purchase order) amount of everything with the same code number in the actuals section has been added up in the running estimates column up the top.

    What I'm wanting to calculate is the "Estimated Final Costs" amounts up the top. What I'd like the formula to do is sum the "actual" amount of everything with the same code number UNLESS the "actual" amount is zero (which means I haven't yet received the invoice for it) in which case I'd like it to use the PO amount (as this is the best estimate I have).

    Hope this makes sense.

  4. #4
    Registered User
    Join Date
    08-20-2016
    Location
    Auckland, New Zealand
    MS-Off Ver
    Mac 2011
    Posts
    7

    Re: Formula for using value in one column if value in another is zero

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-20-2016
    Location
    Drosopila
    MS-Off Ver
    2013
    Posts
    11

    Re: Formula for using value in one column if value in another is zero

    I'm not sure about what you need, but here is a formula that sums:

    ONLY when the red column is equal to the value in Column B
    sums purple column if (purple column <>0)
    adds green column if (purple column =0)

    2po0Voi.jpg

    Is an array Formula, so it should be entered with control+shift+enter
    Last edited by forilohud; 08-20-2016 at 11:54 PM.

  6. #6
    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,946

    Re: Formula for using value in one column if value in another is zero

    Hi, welcome to the forum

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    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

  7. #7
    Registered User
    Join Date
    08-20-2016
    Location
    Auckland, New Zealand
    MS-Off Ver
    Mac 2011
    Posts
    7

    Re: Formula for using value in one column if value in another is zero

    OK, I have tried to attach here...
    Attached Files Attached Files

  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
    52,946

    Re: Formula for using value in one column if value in another is zero

    Try this...
    =SUMIF(B:B,$B2,G:G)+SUMIFS(F:F,B:B,$B2,G:G,0)

    btw, you can change the SUMIF formula to this...
    =SUMIF(B:B,$B2,F:F)

  9. #9
    Registered User
    Join Date
    08-20-2016
    Location
    Auckland, New Zealand
    MS-Off Ver
    Mac 2011
    Posts
    7

    Re: Formula for using value in one column if value in another is zero

    Thank you so much for this. If I need the values for each code to go up in their corresponding cell under the "Estimated Final Costs" are you able to tell me how I do that? Thank you so much!

  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
    52,946

    Re: Formula for using value in one column if value in another is zero

    My suggested formula would go in J2 of your sample
    copied down

  11. #11
    Registered User
    Join Date
    08-20-2016
    Location
    Auckland, New Zealand
    MS-Off Ver
    Mac 2011
    Posts
    7

    Re: Formula for using value in one column if value in another is zero

    Yes, that's perfect, thank you so much!!!! You have saved me hours (days?) of work, I really really appreciate your help :-)

  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
    52,946

    Re: Formula for using value in one column if value in another is zero

    Happy 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)

  13. #13
    Registered User
    Join Date
    08-20-2016
    Location
    Auckland, New Zealand
    MS-Off Ver
    Mac 2011
    Posts
    7

    Thumbs up Re: Formula for using value in one column if value in another is zero

    Will do, thanks so much

+ 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: 2
    Last Post: 05-21-2015, 10:41 PM
  2. Adding a formula column based on the pivot table's Grand Total column
    By trisoldee in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 12-26-2014, 05:29 PM
  3. Replies: 4
    Last Post: 01-16-2014, 12:17 AM
  4. [SOLVED] need formula to this logic, A column number B column blank then C column desired name
    By vengatvj in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 11-02-2013, 10:30 PM
  5. Replies: 1
    Last Post: 05-11-2013, 02:35 AM
  6. Formula/macro to edit cells in one column based on contents of a cell in another column
    By robbyvegas in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-25-2012, 06:10 AM
  7. Replies: 2
    Last Post: 08-04-2006, 03:00 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