Home General Chat
If you need urgent support, call 999 or go to your nearest A&E. To contact our Crisis Messenger (open 24/7) text THEMIX to 85258.
Options

Excel formula problem

Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
Hello... I've been having a problem with excel and i was wondering if anyone familiar with formulas in excel could have a look at one I've written. It's fairly simple and it is about using the IF statement. Here's the formula.
=IF(J7="";"";IF(J7="Nm";IF(M7="";"";IF(M7="N";IF(P7="";"";IF(P7="m";IF(L7=B7*10;IF(O7=C5;IF(I7=L7*O7;data!$D2;data!$D3);data!$D3);data!$D3);data!$D3))))))

In the attachments, I have a picture of the preview of the sheet. To understand the different boxes, i've coloured them and i've provided a key to make helping me a lot easier (not that it will ever be, my apologies :p):

from left to right:
Dark blue (7) = B7
Red (0) = C5
Pinky (12.5) = F5
Light blue (5) = G7
Yellow ("M") = I6
Dark green (should be measurement for M, which = moment) = J6
light green ("F") = L6
purple ("D")= O6
the measurements for F and D are (F)= M6 (D)= P6

The formula i wrote applies for the line under (substitute 6 with 7) - i.e. the line under the colour rings :p. What i want my formula to do is to check all the units first; Nm under dark green, N under green and one to the right and m under purple and one to the right.

My question is... is the formula incorrect in any way? have i missed something or done too many brackets? The problem is, I think the actual problem lies in my software. I've previously tried making such long IF formulas before, and when i've exceeded like 6 IF statements, the formula stops working for some reason (although this only happened at that occasion... I'm still dubious whether this problem is still present and that my formula isn't working because I have so many IF statements that it won't work.

Appreciate any help.

By the way, I'm writing a physics worksheet on moment and turning forces. The formula should be M = D * F. data!$D2 = "correct", whereas data!$D3 = "incorrect".

-Deep Fathom

Comments

  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    sorry I can't help...looks like a foreign language to me lol...hope you get it sorted x x x
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    I'm no good with IF statements but on the brackets thing you should find that they pair up in colours as edit the formula so you can see which '(' excel is pairing your ')' with.

    Are you sure you're referencing the right cells? You can rename the cells (ie give them words as names rather than B7) by clicking on the cell and then typing your name for it into the little white box to the left of the formula box. Doing that helps you find any errors in the formula.

    Good luck

    xx
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    what is it exactly you are trying to work out? angular momentum? edit: oh, moments, I see...

    have you just got to fill in the gaps on your worksheet? or are you writing an interactive excel sheet for x values?

    I dont quite understand what you're trying to achieve with the IF statement. are you comparing your value of angular momentum with values $D2 & $D3 to see if they're correct?
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    Replicant wrote:
    have you just got to fill in the gaps on your worksheet? or are you writing an interactive excel sheet for x values?

    Exactly. I've been working on a worksheet for kids quite below my age (hence the simple level of the questions, although this question is one of the easy ones).
    I dont quite understand what you're trying to achieve with the IF statement. are you comparing your value of angular momentum with values $D2 & $D3 to see if they're correct?

    Sorry, I just realised how confusing it must have been. I have a seperate sheet where I have two boxes, one i've written "correct" and the other "incorrect". The correction box beside the calculation in the Question 3 sheet literally becomes "data!$D3" or "data!$D2" depending on if the IF statement is true or false.

    There is a seperate box beside the calculation, which "corrects" the calculation - it has to check the value and the units. It firstly checks if the box is empty - if nothing has been typed in, it will equal "", or nothing. However, if it is not "" (i.e. nothing written in), then the IF statement will run. The IF statement checks if one box is correct, and then checks the next boxes until all have been done (this is done in a sort of order, where the next IF statement is run only if the first is correct... if one is wrong, that step of the calculation is wrong, and if one is empty (i.e. has not been filled in yet, nothing shows up... otherwise, when they are in the process of completing the question, it will show "incorrect" -- i'll be using these boxes at the end where i'll have a result sheet, which uses SUM and is linked to the different boxes correcting all steps for the calculation (for example, if the final answer is correct but the units are wrong, they might get 2 points out of three etc etc)
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    sounds mighty complicated :p

    I'm afraid I've only really used excel for data analysis. but, that said, you may find it easy split the function up if it's not working, and have an individual IF statement for each x that the student puts in.

    rather than having the testing of the second question only run if the first question is correct, have them all individually checked, and stick data!$D3 or D4 next to it.

    if you get that to work, it should be easier to then combine all of your functions so that answer 2 is only checked once answer 1 is checked etc.
    it will also make it easier to trouble shoot a series of similar, but smaller functions, than one big one :thumb:
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    Replicant wrote:
    sounds mighty complicated :p

    I'm afraid I've only really used excel for data analysis. but, that said, you may find it easy split the function up if it's not working, and have an individual IF statement for each x that the student puts in.

    rather than having the testing of the second question only run if the first question is correct, have them all individually checked, and stick data!$D3 or D4 next to it.

    if you get that to work, it should be easier to then combine all of your functions so that answer 2 is only checked once answer 1 is checked etc.
    it will also make it easier to trouble shoot a series of similar, but smaller functions, than one big one :thumb:

    Yea, I'm going to experiment with different approaches tonight. I'm quite positive with your idea, trying to break it down so it becomes easier to handle later on. Right now, i've got this effing workload i seriously have to finish off... sigh. Home economics really feels like a waste of time. All these hypothetical situations... are almost comical! :razz:
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    The help file for my version of Excel - 2003 - says that you can nest up to 7 levels of IF.

    Also, it uses commas to seperate the parts, not semicolons.

    So you'd probably have to split out the calculations if you need more than 6 tests.
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    Why are you using nested ifs and not case select or whatever the function is called? When I did an assignment on excel nested ifs are 'sloppy' because it's harder to find the problem. Just make a mini table saying what parameters you want it to look for and then the output for each. Will look it up at some point, but at a LAN party atm :)
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    but at a LAN party atm :)

    oooh get you :)
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    Hmm, maybe vlookup wouldnt work in your case.

    As far as I'm aware, aren't different arguments in an IF statement seperated by commas and not semicolons? So it should be:

    =IF(B4=1,"One","Not one")

    If you're still stuck I'm more than happy to help some more :)

    edit: ooh im an idiot and didnt read mists reply ;)
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    when i used excel at college and did IFs i think they said to use "," not ";" might be wrong though
Sign In or Register to comment.