• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

AN =IF Question

Hi Luke M,


Many thanks for your solution which I understood up to a point. As with SirJB7, (See previous post)I have a lot of work to do making the solution 'fit' my piece of work.


With multiple KPI's and gaps between quarters and years i have to be careful to adapt it so everything works as it should.


As I said, I am away next week so so if I have further questions, I shall respond on my return.


In the mean time, grateful thanks for your solution and the timeand trouble you have taken.


Regards


Snowwy
 
Thanks for the kind words Snowwy. Whichever formula you use, the important part is that you know how it works and learn something new/exciting about XL. =)


I see now that you wanted the formula to run horizontal. Changing my formula around, and assuming it goes into cell B2:

=LOOKUP(COLUMN()-MAX(COLUMN($B2)-1,COLUMN($B:B)*($B2:B2=0)),RatchetTable)
 
Hi, Snowwy!

Glad if we helped you. Thank you very much for your feedback and for your kind words too. Welcome back whenever needed or wanted.

Regards!

PS: If you want to share your actual file, so as Luke M and me could see your workbook and worksheets desing, maybe we can help with the formula's adjustments on either both solutions.
 
Hi SirJB7 and Luke M,


Back from the wilds of Siberia...!


I have tried to apply what has been sent with some success, but I think its time to share a file so below is a link with a sample of my dilemma!


Lets hope I can get this bit right.


I look forward to hearing from you.


Regards


Snowwy.


https://www.dropbox.com/s/8zko5tzcl74tg6f/AN%20%3DIF%20Question%20%28from%20Snowwy%20at%20Chandoo%29.xlsx?m
 
Er in case i have done this wrong...


here is the link again.


http://dl.dropbox.com/u/99659186/AN%20%3DIF%20Question%20(from%20Snowwy%20at%20Chandoo).xlsx
 
Hi, Snowwy!


I didn't know you like Siberia so much but in that case I understand you profit to travel on Summer time :)


Regarding your specifications change I'd say that my original solution was intended for contiguous data ranges. Give me some time to evaluate if it could be adapted.


BTW, is it possible to stretch the KPI ranges like this?:

Monthly : Y1M1, Y1M2, Y1M3, Y1M4, Y1M5, Y1M6, Y1M7, Y1M8, Y1M9, Y1M10, Y1M11, Y1M12, ...

Quarterly : Y1Q1, Y1Q2, Y1Q3, Y1Q4, Y2Q1, Y2Q2, Y2Q3, Y2Q4, Y3Q1, Y3Q2, Y3Q3, Y3Q4, ...

Anually : Y1, Y2, Y3, Y4, Y5, Y6, Y7, Y8, Y9, Y10, Y11, Y12, ...


Regards!
 
Hi SirJB7,


I didn't know I liked Siberia either but I now have found I do! Probably not when its below -40 though! The winters are hard I understand...


Regarding your question , yes it would be possible to tabulate them in some fashion as you suggested.


I await with excitement!


Many thanks once more.


Snowwy
 
Hi Snowwy ,


Can you use helper rows ? If yes , check this file :


http://speedy.sh/fSt2t/KPI-Challenge.xlsx


You will need to add a VLOOKUP to get the final ratchet value.


Narayan
 
Hi, Snowwy!

If you tabulate the data in a contiguous form, you've got nothing to change to the original file but replacing the label "Month" by the new period.

Regards!
 
Hi SirJB7,


I am currently developing this for two independent projects.

They are similiar and so contiguous data is possible on one, but the other has gaps due to other measurements so your answer will fit one, but not the other.


Kind Regards


Ian
 
Hi Narayan,


I have had a look at the file you left thank you and I see that it works fine.

To try and understand it though I have taken it apart and this is where I have got to...


Row 1 =IF(D4="",0,IF(D4=0,-999,1)) I understand and is looking for a fine value, a blank or a zero. it then put a 0, -999 or a 1 accordingly.


Row 2 =IFERROR(MATCH(1,1/($C11:C11=-999)),0) I think also I understand, it looks for a match for -999 (no fine) and records its relative position. The error trap puts in a 0 everywhere else.


Row 3 =IF(L27=0,1,MAX(1,SUM(OFFSET($D28,0,L29-1):L28))) This I partly understand The IF L27 simply checks for a fine value in row L and I have changed it to 1 rather than 0 as my Ratchet table starts at 1. The MAX function retrns the highest number in the array but although I have used OFFSET before to return specific locations, I can't quite see how it add up to the correct incremented number shown.


Although it clearly works!!


Could you help with the last peice of the jigsaw then I will try and find a way to hide the helper rows!!!


Many thanks for the time and effort from so many amazing contributors.


I love this site!!


Regards


Snowwy
 
Hi Snowwy ,


I am not so sure things work ! I have tried with more data , and things are going wrong. Please do not use the formulae I have posted.


Narayan
 
Hi Snowwy ,


Please check this revised file :


http://speedy.sh/A2HdW/KPI-Challenge.xlsx


Once you confirm that things really work ( ! ) , I will reply to your earlier post.


Narayan
 
Hi Narayan,


I have downloaded the file and see that Row 2 is different.


Can you explain the workings of it all please?


Regards


Snowwy
 
Hi Snowwy ,


Row 1 is necessary only to make a distinction between a cell which is blank , and a cell which contains 0.


Row 2 is the heart of the logic ; it tells us where the last 0 was encountered :


=MAX(IFERROR(1/($C5:C5=-999)*COLUMN($C5:C5)-2,0))


Since the data starts from column D , we start from column C ; the above formula is in D6. If we look at any intermediate cell , say L6 , we see that the evaluation of the portion :


($C5:C5=-999)


results in an array of values {FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE} ; the FALSE values are because the cells C5 through H5 do not have -999 in them ; I5 does have -999 , which results in a TRUE value ; J5 and K5 again give FALSE outputs.


Since a TRUE is equivalent to 1 , and FALSE equivalent to 0 , we divide 1 by this array to get the following result :


{#DIV/0!,#DIV/0!,#DIV/0!,#DIV/0!,#DIV/0!,#DIV/0!,1,#DIV/0!,#DIV/0!} ----- Intermediate result 1


The next step is multiplying this array by the array resulting from the portion :


COLUMN($C5:K5)-2


The portion COLUMN($C5:K5) gives an array {3,4,5,6,7,8,9,10,11} ; subtracting 2 from this gives :


{1,2,3,4,5,6,7,8,9}


Multiplying this array by the array marked "Intermediate result 1" above gives us the array :


{#DIV/0!,#DIV/0!,#DIV/0!,#DIV/0!,#DIV/0!,#DIV/0!,7,#DIV/0!,#DIV/0!}


The IFERROR wrapper substitutes 0 for all the error values , and the MAX function returns the value 7 ; this is the 7th value from the starting point in column C ; this means that the last 0 encountered was in the 7th column from column C i.e. column I.


Row 3 completes the logic by counting the number of non-zero values starting from the last 0 encountered ; let us look at the formula in cell M7 :


=IF(M4=0,0,MAX(1,SUM(OFFSET($D5,0,M6-1):M5)-1))


If the fine ( in cell M4 ) is 0 , this returns 0 ; if not , it returns the value :


SUM(OFFSET($D5,0,M6-1):M5)-1


where OFFSET($D5,0,M6-1) is the cell containing the last 0. The sum of values from that cell to the current cell tells us how many non-zero fines have been paid. The -1 and the MAX part are to have 2 1s ( 1,1,2,3,4,... ) since the normal sum will just return 1,2,3,4,5,... ; the -1 makes the above series 0,1,2,3,4 , and the MAX function replaces the 0 by 1 , giving the series 1,1,2,3,4,...


If you feel anything is unexplained , please let me know.


Narayan
 
Hi, Snowwy!


While trying to keep all stuff within an only single cell as in my suggestion, I was wondering about the rachet and the fines applied... Would you still be handling the 0,0,1,2,3,5,8,8,8, ... series on a period basis (quarter, year) or you'd be converting the scale to a period/month basis which will lead you to (in the case of quarterly) 0,0,1,5,5,5,8,8,8 or 0,0,0,2,2,2,8,8,8 depending on choose of first or last month of the period?


I ask you this because the fine penalty seems to be not very much applicable to long terms in higher periodicities (higher months of periodicity, I mean. And as the whole thing it's about fines...


I hope you understand my question.


Regards!
 
Hi SirJB7,

The fine ratchet is based on a repeat failure in any given period depending on the relevant KPI. The table just dictates the severity based on the number of instances of failure.


Many thanks for your help


Snowwy
 
To all those who have helped in this question, many many thanks.


I am amazed at the expertise from around the world and the willingness to share their time with those in need.


Thank you so much, I now have sufficient choices of solutions to resolve my query.


I also have grown in knowledge thanks to you all.


Kind Regards


Snowwy


Awesome site!!!
 
Hi, Snowwy!


Glad you solved it. ...Did you really solved it or still having any kind of concerns about the source data distribution with or without blanks? Just to know if further tweaking needed.


Thank you very much for your feedback and for your kind words too. And welcome back whenever needed or wanted.


Regards!
 
Back
Top