+ Reply to Thread
Results 1 to 12 of 12

Simplify if function

Hybrid View

keis386 Simplify if function 06-19-2011, 11:25 AM
MarvinP Re: Simplify if function 06-19-2011, 01:08 PM
keis386 Re: Simplify if function 06-19-2011, 01:47 PM
Marcol Re: Simplify if function 06-19-2011, 01:49 PM
keis386 Re: Simplify if function 06-19-2011, 03:37 PM
Marcol Re: Simplify if function 06-19-2011, 04:01 PM
keis386 Re: Simplify if function 06-19-2011, 04:22 PM
keis386 Re: Simplify if function 06-19-2011, 04:39 PM
Marcol Re: Simplify if function 06-19-2011, 09:34 PM
keis386 Re: Simplify if function 06-20-2011, 03:22 AM
Marcol Re: Simplify if function 06-20-2011, 01:30 PM
keis386 Re: Simplify if function 06-21-2011, 08:05 AM
  1. #1
    Forum Contributor
    Join Date
    01-17-2011
    Location
    amsterdam, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    189

    Simplify if function

    I want to simplify the formula in column E, for small samples it is easy but I need to use it for a really large sample.
    The formula is a if function
    The formula: look first if the formula above the cell is a zero if this is not the case, look if the cell above that cell is a zero, if that is not the case look if the cell above that cell is a zero and so on. If the value in the cell is an one the answer is the cell right of it.

    I have attached a example, the idea is really simple, if you look at the formula in cell b9 you get the idea

    I hope someone can help me.

    Thanks!
    Attached Files Attached Files
    Last edited by keis386; 06-19-2011 at 02:12 PM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,253

    Re: Simplify if function

    Hi keis386,

    I think you want this formula in B4 and pull it down the column B.

    =OFFSET(B4,0,1+COUNTIF(B$3:B3,">0"))
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Contributor
    Join Date
    01-17-2011
    Location
    amsterdam, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    189

    Re: Simplify if function

    Thans for you help, but it is not exactly what i was looking for. I paste it in B4 and I still have other answers.
    In column B you have to look above you where the first 1 is, if there is a 1 you go to the right and pick the value in the diagonal d6, e7, f8, g9 enz...

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Simplify if function

    Try this workbook

    In A4 (Helper Column)
    =IF(COUNTIF(C4:S4,0)>0,ROW()+1,"")
    In B4
    =IF(B3=0,IF(MAX($A$4:$A4)=0,C4,INDEX($A$1:$S4,MAX($A3:$A$4),COUNT(C4:S4))),INDEX($A$1:$S4,ROW(),COUNT(C4:S4)+1))
    Drag/Fill Both Down

    This should give results up to Column S, extend this in all references as required
    e.g.
    INDEX($A$1:$S4,ROW(),COUNT(C4:S4)+1)
    might become
    INDEX($A$1:$X4,ROW(),COUNT(C4:X4)+1)

    Hope this helps
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  5. #5
    Forum Contributor
    Join Date
    01-17-2011
    Location
    amsterdam, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    189

    Re: Simplify if function

    Thanks for you help, I still have one small question.
    In my excel sheet I pasted the new formulas.
    I had to drag down to 252, but every 20 cells there begins a new matrix. The only I do not really get is how the index function changes.
    Does it stay the same or is it like INDEX($A$21:$S24 , so plus 20?
    Under here is the formula you gave to me.
    Thanks!

    =IF(B3=0,IF(MAX($A$4:$A4)=0,C4,INDEX($A$1:$S4,MAX($A3:$A$4),COUNT(C4:S4))),INDEX($A$1:$S4,ROW(),COUNT(C4:S4)+1))

  6. #6
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Simplify if function

    Can you post a sample workbook showing your layout and typical values?
    Say 60 or so rows (3 matrices) so we can identify how and where each one begins and ends.

  7. #7
    Forum Contributor
    Join Date
    01-17-2011
    Location
    amsterdam, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    189

    Re: Simplify if function

    The matrix is in in column M to AE

    the help column I pasted in column AV
    And the other formula I pasted in column L. So thats where the problem lies.
    Because at row 23 there begins a new matrix, and at row 42 there begins a new matrix the matrix aren't exactly the same in size.
    Thanks for your help!
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    01-17-2011
    Location
    amsterdam, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    189

    Re: Simplify if function

    o and it isnt possible to move the matrixen because they exist of a lot of formulas

  9. #9
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Simplify if function

    There seems to be a mass of formulae overlapping your matrices range (Columns M:AR)
    Is this correct?

    I can't see any rhyme, or reason, why they are within this range.

    Go Formulas > Show Formulas to see what I mean.

  10. #10
    Forum Contributor
    Join Date
    01-17-2011
    Location
    amsterdam, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    189

    Re: Simplify if function

    I made a lot less complicated, the only problem still is column L for the second and third matrix. I changed already several numbers in the formula, I think the problem lies by the index part. See attachment
    Attached Files Attached Files
    Last edited by keis386; 06-20-2011 at 07:02 AM.

  11. #11
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Simplify if function

    I'm still not clear what your end result should be.

    Try this workbook

    I have cleaned out all formula and cells with spaces rarther than blanks then added some conditional formatting to make the data a bit easier to read.

    I have added the following macros

    1/. "CleanMatrices" This cleans out all formula and non numeric values from the matrice area.

    2/. "ValuesByAlternateRows" This is only for checking purposes.
    It changes all numeric values, greater than zero, to sequential numbers, this should make it easier to check if the proper value is returned in Column L

    3/. "ValuesByColumn" This is similar to the above, but it changes all numeric values, greater than zero, to the value in the "Header" row 2.

    4/. "ReturnValuesToOnes" does as the name suggests, changes all numeric values, greater than zero, back to 1.

    Use these macros to visually check if the the values returned by the formula in Column L are correct.

    There is a formula in Column A that numbers the rows for each matrix.

    Let me know if this is correct, and if not try explaining the result you are expecting on a worksheet with no formula change the "1" to return with something unique, maybe use colours to show the options.

    The formulae you originally posted seem to ignore the last value in every row.
    Is this correct?
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    01-17-2011
    Location
    amsterdam, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    189

    Re: Simplify if function

    This is the best hulp I ever had! Thank you very much! Everything works now!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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