We're aware that some users are experiencing technical issues which the team are working to resolve. See the Community Noticeboard for more info. Thank you for your patience.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!

Any Google Sheets wizards that can help?

Options
firsttimebuyer2013
firsttimebuyer2013 Posts: 159 Forumite
edited 15 February 2017 at 1:55AM in Techie Stuff
Basically, I'm trying to get a sheet to do a sum, depending on what the drop down menu says.

2qsw7r6.png

The drop down menu will have about 4 options. The first one, if 'Cost' is selected, has to be C2-B2 witht the result in D2.

The second, with 'Profit', or two other choices under the dropdown (for example bonus, gift), just need to be whatever the value of C3 is to appear in D3.

Is this possible at all? :o

Thank you

Comments

  • I had a look at that sheet but I'm still none the wiser. Can anyone help?
  • bluesnake
    bluesnake Posts: 1,460 Forumite
    firsttimebuyer2013, the above link, look at row 5 in the example instead of "Yes", replace with "Cost", then do your sums

    looks like you will need the OR function too to

    A gift is a loss, so it is -1*C3 to appear in D3 ???
  • cookie365
    cookie365 Posts: 1,809 Forumite
    edited 15 February 2017 at 7:11PM
    I'm not going to second guess what the correct calculations should be.

    If I've read the OP right then the calculation is that if the dropdown says 'Cost' it should be one calculation, and if it says anything else it should be another. In which case

    H6x6cOiFTDqMAAAAAElFTkSuQmCCpnEmgayRp

    [STRIKE]Otherwise, if there's a third calculation, 'nest' it where the final 'C2' bit is.[/STRIKE]

    Edit: apparantly you can't nest IF statements on google sheets. That will make things interesting :(
  • bluesnake
    bluesnake Posts: 1,460 Forumite
    cookie365 wrote: »
    I'm not going to second guess what the correct calculations should be.

    If I've read the OP right then the calculation is that if the dropdown says 'Cost' it should be one calculation, and if it says anything else it should be another. In which case

    H6x6cOiFTDqMAAAAAElFTkSuQmCCpnEmgayRp

    [STRIKE]Otherwise, if there's a third calculation, 'nest' it where the final 'C2' bit is.[/STRIKE]

    Edit: apparantly you can't nest IF statements on google sheets. That will make things interesting :(
    You can nest IF, but looks weird at first. D2 becomes
    =if(A2="Cost",C2-B2, IF(A2="Gift",B2/-1, IF(A2="Profit",C2, IF(A2="Bonus","send money to bluesnake"))))
    
  • cookie365
    cookie365 Posts: 1,809 Forumite
    edited 15 February 2017 at 9:13PM
    bluesnake wrote: »
    You can nest IF, but looks weird at first. D2 becomes
    =if(A2="Cost",C2-B2, IF(A2="Gift",B2/-1, IF(A2="Profit",C2, IF(A2="Bonus","send money to bluesnake"))))
    
    Ah yes, I found when I was in the nest clicking cells didn't copy them into the formula, so I assumed it wasn't possible. Just tried manually entering the nested formula and it works fine.
    Capture.Nest%20-%20Copy_zpsour8uwqd.png

    The way this formula works is it first looks at A2 and decides if it contains 'Cost'. If it does, it sets the cell to C2-B2 and stops. If it doesn't, it looks at the second IF statement.

    It then looks to see if A2 contains 'Gift'. If it does, it sets the value to the negative flip of C2 and stops. If it doesn't, it sets the value to C2 and as there are no more nests the formula finishes.
  • cookie365 wrote: »
    Ah yes, I found when I was in the nest clicking cells didn't copy them into the formula, so I assumed it wasn't possible. Just tried manually entering the nested formula and it works fine.
    Capture.Nest%20-%20Copy_zpsour8uwqd.png

    The way this formula works is it first looks at A2 and decides if it contains 'Cost'. If it does, it sets the cell to C2-B2 and stops. If it doesn't, it looks at the second IF statement.

    It then looks to see if A2 contains 'Gift'. If it does, it sets the value to the negative flip of C2 and stops. If it doesn't, it sets the value to C2 and as there are no more nests the formula finishes.

    Thank you so much. Actually got it to work. Really appreciate that. :beer:
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 350.8K Banking & Borrowing
  • 253.1K Reduce Debt & Boost Income
  • 453.5K Spending & Discounts
  • 243.8K Work, Benefits & Business
  • 598.7K Mortgages, Homes & Bills
  • 176.8K Life & Family
  • 257.1K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.1K Discuss & Feedback
  • 37.6K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.