Excel Formula to find the first higher value











up vote
0
down vote

favorite












In column D (Result), I would like to have the following formula.



For each Cell in column C, find in column B the first value higher than the value of the cell of column C (starting from the same row) and gives as output the difference between the values found in column A (Count).



Example:
the value in C2 is 40. the first cell of B that has a value higher than 40 is B6. So D2 takes A6.value - A2.value = 5 - 1 = 4.



Can it be done without the use of VBA?



enter image description here










share|improve this question
























  • What have you tried until now? Probably you could get this with MAX, MATCH and INDEX, using them in array formulas. Also, are the values in Column B unique, or could have duplicates? this is very important if you are looking for the max value.
    – Foxfire And Burns And Burns
    Nov 8 at 9:41










  • P.S. Ok, no MAX, but indeed MATCH and INDEX
    – Foxfire And Burns And Burns
    Nov 8 at 9:49










  • Also, your results makes no sense, following your rules, should not D3=-1, D5=-3?
    – Foxfire And Burns And Burns
    Nov 8 at 10:00










  • @FoxfireAndBurnsAndBurns in case of D3: I have to find a value higher than 30 on the column B starting from the row 3; this value is in B4, so D3 takes 4-3=1.
    – Stefano
    Nov 8 at 10:07






  • 1




    Then, D5 should be 0 instead of 1, because the first higher value in column B is B5, so A5-A5 is 0. Why is it 1?
    – Foxfire And Burns And Burns
    Nov 8 at 10:16

















up vote
0
down vote

favorite












In column D (Result), I would like to have the following formula.



For each Cell in column C, find in column B the first value higher than the value of the cell of column C (starting from the same row) and gives as output the difference between the values found in column A (Count).



Example:
the value in C2 is 40. the first cell of B that has a value higher than 40 is B6. So D2 takes A6.value - A2.value = 5 - 1 = 4.



Can it be done without the use of VBA?



enter image description here










share|improve this question
























  • What have you tried until now? Probably you could get this with MAX, MATCH and INDEX, using them in array formulas. Also, are the values in Column B unique, or could have duplicates? this is very important if you are looking for the max value.
    – Foxfire And Burns And Burns
    Nov 8 at 9:41










  • P.S. Ok, no MAX, but indeed MATCH and INDEX
    – Foxfire And Burns And Burns
    Nov 8 at 9:49










  • Also, your results makes no sense, following your rules, should not D3=-1, D5=-3?
    – Foxfire And Burns And Burns
    Nov 8 at 10:00










  • @FoxfireAndBurnsAndBurns in case of D3: I have to find a value higher than 30 on the column B starting from the row 3; this value is in B4, so D3 takes 4-3=1.
    – Stefano
    Nov 8 at 10:07






  • 1




    Then, D5 should be 0 instead of 1, because the first higher value in column B is B5, so A5-A5 is 0. Why is it 1?
    – Foxfire And Burns And Burns
    Nov 8 at 10:16















up vote
0
down vote

favorite









up vote
0
down vote

favorite











In column D (Result), I would like to have the following formula.



For each Cell in column C, find in column B the first value higher than the value of the cell of column C (starting from the same row) and gives as output the difference between the values found in column A (Count).



Example:
the value in C2 is 40. the first cell of B that has a value higher than 40 is B6. So D2 takes A6.value - A2.value = 5 - 1 = 4.



Can it be done without the use of VBA?



enter image description here










share|improve this question















In column D (Result), I would like to have the following formula.



For each Cell in column C, find in column B the first value higher than the value of the cell of column C (starting from the same row) and gives as output the difference between the values found in column A (Count).



Example:
the value in C2 is 40. the first cell of B that has a value higher than 40 is B6. So D2 takes A6.value - A2.value = 5 - 1 = 4.



Can it be done without the use of VBA?



enter image description here







excel






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 8 at 10:13

























asked Nov 8 at 9:36









Stefano

7618




7618












  • What have you tried until now? Probably you could get this with MAX, MATCH and INDEX, using them in array formulas. Also, are the values in Column B unique, or could have duplicates? this is very important if you are looking for the max value.
    – Foxfire And Burns And Burns
    Nov 8 at 9:41










  • P.S. Ok, no MAX, but indeed MATCH and INDEX
    – Foxfire And Burns And Burns
    Nov 8 at 9:49










  • Also, your results makes no sense, following your rules, should not D3=-1, D5=-3?
    – Foxfire And Burns And Burns
    Nov 8 at 10:00










  • @FoxfireAndBurnsAndBurns in case of D3: I have to find a value higher than 30 on the column B starting from the row 3; this value is in B4, so D3 takes 4-3=1.
    – Stefano
    Nov 8 at 10:07






  • 1




    Then, D5 should be 0 instead of 1, because the first higher value in column B is B5, so A5-A5 is 0. Why is it 1?
    – Foxfire And Burns And Burns
    Nov 8 at 10:16




















  • What have you tried until now? Probably you could get this with MAX, MATCH and INDEX, using them in array formulas. Also, are the values in Column B unique, or could have duplicates? this is very important if you are looking for the max value.
    – Foxfire And Burns And Burns
    Nov 8 at 9:41










  • P.S. Ok, no MAX, but indeed MATCH and INDEX
    – Foxfire And Burns And Burns
    Nov 8 at 9:49










  • Also, your results makes no sense, following your rules, should not D3=-1, D5=-3?
    – Foxfire And Burns And Burns
    Nov 8 at 10:00










  • @FoxfireAndBurnsAndBurns in case of D3: I have to find a value higher than 30 on the column B starting from the row 3; this value is in B4, so D3 takes 4-3=1.
    – Stefano
    Nov 8 at 10:07






  • 1




    Then, D5 should be 0 instead of 1, because the first higher value in column B is B5, so A5-A5 is 0. Why is it 1?
    – Foxfire And Burns And Burns
    Nov 8 at 10:16


















What have you tried until now? Probably you could get this with MAX, MATCH and INDEX, using them in array formulas. Also, are the values in Column B unique, or could have duplicates? this is very important if you are looking for the max value.
– Foxfire And Burns And Burns
Nov 8 at 9:41




What have you tried until now? Probably you could get this with MAX, MATCH and INDEX, using them in array formulas. Also, are the values in Column B unique, or could have duplicates? this is very important if you are looking for the max value.
– Foxfire And Burns And Burns
Nov 8 at 9:41












P.S. Ok, no MAX, but indeed MATCH and INDEX
– Foxfire And Burns And Burns
Nov 8 at 9:49




P.S. Ok, no MAX, but indeed MATCH and INDEX
– Foxfire And Burns And Burns
Nov 8 at 9:49












Also, your results makes no sense, following your rules, should not D3=-1, D5=-3?
– Foxfire And Burns And Burns
Nov 8 at 10:00




Also, your results makes no sense, following your rules, should not D3=-1, D5=-3?
– Foxfire And Burns And Burns
Nov 8 at 10:00












@FoxfireAndBurnsAndBurns in case of D3: I have to find a value higher than 30 on the column B starting from the row 3; this value is in B4, so D3 takes 4-3=1.
– Stefano
Nov 8 at 10:07




@FoxfireAndBurnsAndBurns in case of D3: I have to find a value higher than 30 on the column B starting from the row 3; this value is in B4, so D3 takes 4-3=1.
– Stefano
Nov 8 at 10:07




1




1




Then, D5 should be 0 instead of 1, because the first higher value in column B is B5, so A5-A5 is 0. Why is it 1?
– Foxfire And Burns And Burns
Nov 8 at 10:16






Then, D5 should be 0 instead of 1, because the first higher value in column B is B5, so A5-A5 is 0. Why is it 1?
– Foxfire And Burns And Burns
Nov 8 at 10:16














4 Answers
4






active

oldest

votes

















up vote
3
down vote













It can easily be accomplished with an array formula (so you have to enter the formula with Ctrl+Shift+Enter ) :
{=MATCH(TRUE;IF(B2:$B$7>C2;TRUE;FALSE);0)-1}



Put this formula in cell D2, and just drag down. You only have to change the end of your data set (change $B$7 into the real last cell of the column with data)



The formula works as follows :




  • The IF statement results in an array with TRUE/FALSE values that meet your criteria : {FALSE;FALSE;FALSE;FALSE;TRUE;FALSE}

  • The MATCH (with the 0 switch) searches the array for the index of the first match, which is 5 in our case

  • And you have to subtract 1 to get the offset to the cell where the function is placed, so this gives you 4


So although you have to enter it as an array formula (you will get an N/A error without the ctrl+shift+enter), the result is just a single number.

Also, depending on your data set, you might want to add some ERROR handling in case no match has been found, e.g. just using the example data set in your question, the result in cell D5 will be N/A so you have to decide what value you want the result to be in such case.

And finally, I did not use the values in column A, as I assumed this is just a sequential ascending counter. If this is not the case, and you specifically want to find the difference between the corresponding values in that column, you can use the variant mentioned by Foxfire... in one of the other answers: =MIN(IF(B2:$B$6>C2;A2:$A$6))-A2






share|improve this answer























  • Nice! Much cleaner than my answer ;-)
    – Marco Vos
    Nov 8 at 11:22












  • @MarcoVos Bedankt ! Don't we all just love array formulas ... ;))
    – Peter K.
    Nov 8 at 11:26


















up vote
1
down vote













A slightly adjusted and shortened answer on Peter K.'s suggestion:
In D2:



=MATCH(TRUE,$B3:B$7>C2,0)


enter the formula with ctrl+shift+enter






share|improve this answer





















  • Why you exclude B2 from the range?
    – Foxfire And Burns And Burns
    Nov 8 at 12:18










  • Because the first is 1 not 0 + not checking the count in first column and see pic of OP in cell D5
    – EvR
    Nov 8 at 12:24












  • Yeah, but OP said starting in the same row, but you are excluding it in yor formula. you start always 1 row below.
    – Foxfire And Burns And Burns
    Nov 8 at 12:51










  • Anyways, I think your formula is exactly what OP needs and that OP is not explaining the question properly, so I'm upvoting it
    – Foxfire And Burns And Burns
    Nov 8 at 12:57




















up vote
0
down vote













Something like this should work for you. First transform your range to a table.



=IFERROR(AGGREGATE(15,6,--([@Second]<[First])*(ROW([@Second])<=ROW([First]))/--([@Second]<[First]*(ROW([@Second])<=ROW([First])))*[Count],1) - [@Count],"")


In this formula the comparison between [second] and [First] starts at the same row. That means that the value in D5 is 0 and not 1. (Like @Foxfire And Burns And Burnslike stated in the comments).






share|improve this answer




























    up vote
    0
    down vote













    Ok, I did not post the answer waiting until OP answered why D5 is 1 instead of 0, but my formula is also an array formula. It would be:



    =MIN(IF(B2:$B$6>C2;A2:$A$6))-A2


    To type this formula in array mode, you need to type it as usual, but instead of pressing ENTER, you need to press CTRL+SHIFT+ENTER






    share|improve this answer























    • What does SI mean
      – Marco Vos
      Nov 8 at 13:39










    • @MarcoVos OMG!!! SI=IF. Thanks for that!. I posted the formula in spanish, and forgot the translation. tHANKS!
      – Foxfire And Burns And Burns
      Nov 8 at 15:52











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53204966%2fexcel-formula-to-find-the-first-higher-value%23new-answer', 'question_page');
    }
    );

    Post as a guest
































    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    3
    down vote













    It can easily be accomplished with an array formula (so you have to enter the formula with Ctrl+Shift+Enter ) :
    {=MATCH(TRUE;IF(B2:$B$7>C2;TRUE;FALSE);0)-1}



    Put this formula in cell D2, and just drag down. You only have to change the end of your data set (change $B$7 into the real last cell of the column with data)



    The formula works as follows :




    • The IF statement results in an array with TRUE/FALSE values that meet your criteria : {FALSE;FALSE;FALSE;FALSE;TRUE;FALSE}

    • The MATCH (with the 0 switch) searches the array for the index of the first match, which is 5 in our case

    • And you have to subtract 1 to get the offset to the cell where the function is placed, so this gives you 4


    So although you have to enter it as an array formula (you will get an N/A error without the ctrl+shift+enter), the result is just a single number.

    Also, depending on your data set, you might want to add some ERROR handling in case no match has been found, e.g. just using the example data set in your question, the result in cell D5 will be N/A so you have to decide what value you want the result to be in such case.

    And finally, I did not use the values in column A, as I assumed this is just a sequential ascending counter. If this is not the case, and you specifically want to find the difference between the corresponding values in that column, you can use the variant mentioned by Foxfire... in one of the other answers: =MIN(IF(B2:$B$6>C2;A2:$A$6))-A2






    share|improve this answer























    • Nice! Much cleaner than my answer ;-)
      – Marco Vos
      Nov 8 at 11:22












    • @MarcoVos Bedankt ! Don't we all just love array formulas ... ;))
      – Peter K.
      Nov 8 at 11:26















    up vote
    3
    down vote













    It can easily be accomplished with an array formula (so you have to enter the formula with Ctrl+Shift+Enter ) :
    {=MATCH(TRUE;IF(B2:$B$7>C2;TRUE;FALSE);0)-1}



    Put this formula in cell D2, and just drag down. You only have to change the end of your data set (change $B$7 into the real last cell of the column with data)



    The formula works as follows :




    • The IF statement results in an array with TRUE/FALSE values that meet your criteria : {FALSE;FALSE;FALSE;FALSE;TRUE;FALSE}

    • The MATCH (with the 0 switch) searches the array for the index of the first match, which is 5 in our case

    • And you have to subtract 1 to get the offset to the cell where the function is placed, so this gives you 4


    So although you have to enter it as an array formula (you will get an N/A error without the ctrl+shift+enter), the result is just a single number.

    Also, depending on your data set, you might want to add some ERROR handling in case no match has been found, e.g. just using the example data set in your question, the result in cell D5 will be N/A so you have to decide what value you want the result to be in such case.

    And finally, I did not use the values in column A, as I assumed this is just a sequential ascending counter. If this is not the case, and you specifically want to find the difference between the corresponding values in that column, you can use the variant mentioned by Foxfire... in one of the other answers: =MIN(IF(B2:$B$6>C2;A2:$A$6))-A2






    share|improve this answer























    • Nice! Much cleaner than my answer ;-)
      – Marco Vos
      Nov 8 at 11:22












    • @MarcoVos Bedankt ! Don't we all just love array formulas ... ;))
      – Peter K.
      Nov 8 at 11:26













    up vote
    3
    down vote










    up vote
    3
    down vote









    It can easily be accomplished with an array formula (so you have to enter the formula with Ctrl+Shift+Enter ) :
    {=MATCH(TRUE;IF(B2:$B$7>C2;TRUE;FALSE);0)-1}



    Put this formula in cell D2, and just drag down. You only have to change the end of your data set (change $B$7 into the real last cell of the column with data)



    The formula works as follows :




    • The IF statement results in an array with TRUE/FALSE values that meet your criteria : {FALSE;FALSE;FALSE;FALSE;TRUE;FALSE}

    • The MATCH (with the 0 switch) searches the array for the index of the first match, which is 5 in our case

    • And you have to subtract 1 to get the offset to the cell where the function is placed, so this gives you 4


    So although you have to enter it as an array formula (you will get an N/A error without the ctrl+shift+enter), the result is just a single number.

    Also, depending on your data set, you might want to add some ERROR handling in case no match has been found, e.g. just using the example data set in your question, the result in cell D5 will be N/A so you have to decide what value you want the result to be in such case.

    And finally, I did not use the values in column A, as I assumed this is just a sequential ascending counter. If this is not the case, and you specifically want to find the difference between the corresponding values in that column, you can use the variant mentioned by Foxfire... in one of the other answers: =MIN(IF(B2:$B$6>C2;A2:$A$6))-A2






    share|improve this answer














    It can easily be accomplished with an array formula (so you have to enter the formula with Ctrl+Shift+Enter ) :
    {=MATCH(TRUE;IF(B2:$B$7>C2;TRUE;FALSE);0)-1}



    Put this formula in cell D2, and just drag down. You only have to change the end of your data set (change $B$7 into the real last cell of the column with data)



    The formula works as follows :




    • The IF statement results in an array with TRUE/FALSE values that meet your criteria : {FALSE;FALSE;FALSE;FALSE;TRUE;FALSE}

    • The MATCH (with the 0 switch) searches the array for the index of the first match, which is 5 in our case

    • And you have to subtract 1 to get the offset to the cell where the function is placed, so this gives you 4


    So although you have to enter it as an array formula (you will get an N/A error without the ctrl+shift+enter), the result is just a single number.

    Also, depending on your data set, you might want to add some ERROR handling in case no match has been found, e.g. just using the example data set in your question, the result in cell D5 will be N/A so you have to decide what value you want the result to be in such case.

    And finally, I did not use the values in column A, as I assumed this is just a sequential ascending counter. If this is not the case, and you specifically want to find the difference between the corresponding values in that column, you can use the variant mentioned by Foxfire... in one of the other answers: =MIN(IF(B2:$B$6>C2;A2:$A$6))-A2







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 8 at 12:41

























    answered Nov 8 at 11:14









    Peter K.

    3198




    3198












    • Nice! Much cleaner than my answer ;-)
      – Marco Vos
      Nov 8 at 11:22












    • @MarcoVos Bedankt ! Don't we all just love array formulas ... ;))
      – Peter K.
      Nov 8 at 11:26


















    • Nice! Much cleaner than my answer ;-)
      – Marco Vos
      Nov 8 at 11:22












    • @MarcoVos Bedankt ! Don't we all just love array formulas ... ;))
      – Peter K.
      Nov 8 at 11:26
















    Nice! Much cleaner than my answer ;-)
    – Marco Vos
    Nov 8 at 11:22






    Nice! Much cleaner than my answer ;-)
    – Marco Vos
    Nov 8 at 11:22














    @MarcoVos Bedankt ! Don't we all just love array formulas ... ;))
    – Peter K.
    Nov 8 at 11:26




    @MarcoVos Bedankt ! Don't we all just love array formulas ... ;))
    – Peter K.
    Nov 8 at 11:26












    up vote
    1
    down vote













    A slightly adjusted and shortened answer on Peter K.'s suggestion:
    In D2:



    =MATCH(TRUE,$B3:B$7>C2,0)


    enter the formula with ctrl+shift+enter






    share|improve this answer





















    • Why you exclude B2 from the range?
      – Foxfire And Burns And Burns
      Nov 8 at 12:18










    • Because the first is 1 not 0 + not checking the count in first column and see pic of OP in cell D5
      – EvR
      Nov 8 at 12:24












    • Yeah, but OP said starting in the same row, but you are excluding it in yor formula. you start always 1 row below.
      – Foxfire And Burns And Burns
      Nov 8 at 12:51










    • Anyways, I think your formula is exactly what OP needs and that OP is not explaining the question properly, so I'm upvoting it
      – Foxfire And Burns And Burns
      Nov 8 at 12:57

















    up vote
    1
    down vote













    A slightly adjusted and shortened answer on Peter K.'s suggestion:
    In D2:



    =MATCH(TRUE,$B3:B$7>C2,0)


    enter the formula with ctrl+shift+enter






    share|improve this answer





















    • Why you exclude B2 from the range?
      – Foxfire And Burns And Burns
      Nov 8 at 12:18










    • Because the first is 1 not 0 + not checking the count in first column and see pic of OP in cell D5
      – EvR
      Nov 8 at 12:24












    • Yeah, but OP said starting in the same row, but you are excluding it in yor formula. you start always 1 row below.
      – Foxfire And Burns And Burns
      Nov 8 at 12:51










    • Anyways, I think your formula is exactly what OP needs and that OP is not explaining the question properly, so I'm upvoting it
      – Foxfire And Burns And Burns
      Nov 8 at 12:57















    up vote
    1
    down vote










    up vote
    1
    down vote









    A slightly adjusted and shortened answer on Peter K.'s suggestion:
    In D2:



    =MATCH(TRUE,$B3:B$7>C2,0)


    enter the formula with ctrl+shift+enter






    share|improve this answer












    A slightly adjusted and shortened answer on Peter K.'s suggestion:
    In D2:



    =MATCH(TRUE,$B3:B$7>C2,0)


    enter the formula with ctrl+shift+enter







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 8 at 12:11









    EvR

    9911312




    9911312












    • Why you exclude B2 from the range?
      – Foxfire And Burns And Burns
      Nov 8 at 12:18










    • Because the first is 1 not 0 + not checking the count in first column and see pic of OP in cell D5
      – EvR
      Nov 8 at 12:24












    • Yeah, but OP said starting in the same row, but you are excluding it in yor formula. you start always 1 row below.
      – Foxfire And Burns And Burns
      Nov 8 at 12:51










    • Anyways, I think your formula is exactly what OP needs and that OP is not explaining the question properly, so I'm upvoting it
      – Foxfire And Burns And Burns
      Nov 8 at 12:57




















    • Why you exclude B2 from the range?
      – Foxfire And Burns And Burns
      Nov 8 at 12:18










    • Because the first is 1 not 0 + not checking the count in first column and see pic of OP in cell D5
      – EvR
      Nov 8 at 12:24












    • Yeah, but OP said starting in the same row, but you are excluding it in yor formula. you start always 1 row below.
      – Foxfire And Burns And Burns
      Nov 8 at 12:51










    • Anyways, I think your formula is exactly what OP needs and that OP is not explaining the question properly, so I'm upvoting it
      – Foxfire And Burns And Burns
      Nov 8 at 12:57


















    Why you exclude B2 from the range?
    – Foxfire And Burns And Burns
    Nov 8 at 12:18




    Why you exclude B2 from the range?
    – Foxfire And Burns And Burns
    Nov 8 at 12:18












    Because the first is 1 not 0 + not checking the count in first column and see pic of OP in cell D5
    – EvR
    Nov 8 at 12:24






    Because the first is 1 not 0 + not checking the count in first column and see pic of OP in cell D5
    – EvR
    Nov 8 at 12:24














    Yeah, but OP said starting in the same row, but you are excluding it in yor formula. you start always 1 row below.
    – Foxfire And Burns And Burns
    Nov 8 at 12:51




    Yeah, but OP said starting in the same row, but you are excluding it in yor formula. you start always 1 row below.
    – Foxfire And Burns And Burns
    Nov 8 at 12:51












    Anyways, I think your formula is exactly what OP needs and that OP is not explaining the question properly, so I'm upvoting it
    – Foxfire And Burns And Burns
    Nov 8 at 12:57






    Anyways, I think your formula is exactly what OP needs and that OP is not explaining the question properly, so I'm upvoting it
    – Foxfire And Burns And Burns
    Nov 8 at 12:57












    up vote
    0
    down vote













    Something like this should work for you. First transform your range to a table.



    =IFERROR(AGGREGATE(15,6,--([@Second]<[First])*(ROW([@Second])<=ROW([First]))/--([@Second]<[First]*(ROW([@Second])<=ROW([First])))*[Count],1) - [@Count],"")


    In this formula the comparison between [second] and [First] starts at the same row. That means that the value in D5 is 0 and not 1. (Like @Foxfire And Burns And Burnslike stated in the comments).






    share|improve this answer

























      up vote
      0
      down vote













      Something like this should work for you. First transform your range to a table.



      =IFERROR(AGGREGATE(15,6,--([@Second]<[First])*(ROW([@Second])<=ROW([First]))/--([@Second]<[First]*(ROW([@Second])<=ROW([First])))*[Count],1) - [@Count],"")


      In this formula the comparison between [second] and [First] starts at the same row. That means that the value in D5 is 0 and not 1. (Like @Foxfire And Burns And Burnslike stated in the comments).






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        Something like this should work for you. First transform your range to a table.



        =IFERROR(AGGREGATE(15,6,--([@Second]<[First])*(ROW([@Second])<=ROW([First]))/--([@Second]<[First]*(ROW([@Second])<=ROW([First])))*[Count],1) - [@Count],"")


        In this formula the comparison between [second] and [First] starts at the same row. That means that the value in D5 is 0 and not 1. (Like @Foxfire And Burns And Burnslike stated in the comments).






        share|improve this answer












        Something like this should work for you. First transform your range to a table.



        =IFERROR(AGGREGATE(15,6,--([@Second]<[First])*(ROW([@Second])<=ROW([First]))/--([@Second]<[First]*(ROW([@Second])<=ROW([First])))*[Count],1) - [@Count],"")


        In this formula the comparison between [second] and [First] starts at the same row. That means that the value in D5 is 0 and not 1. (Like @Foxfire And Burns And Burnslike stated in the comments).







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 8 at 11:12









        Marco Vos

        1,854149




        1,854149






















            up vote
            0
            down vote













            Ok, I did not post the answer waiting until OP answered why D5 is 1 instead of 0, but my formula is also an array formula. It would be:



            =MIN(IF(B2:$B$6>C2;A2:$A$6))-A2


            To type this formula in array mode, you need to type it as usual, but instead of pressing ENTER, you need to press CTRL+SHIFT+ENTER






            share|improve this answer























            • What does SI mean
              – Marco Vos
              Nov 8 at 13:39










            • @MarcoVos OMG!!! SI=IF. Thanks for that!. I posted the formula in spanish, and forgot the translation. tHANKS!
              – Foxfire And Burns And Burns
              Nov 8 at 15:52















            up vote
            0
            down vote













            Ok, I did not post the answer waiting until OP answered why D5 is 1 instead of 0, but my formula is also an array formula. It would be:



            =MIN(IF(B2:$B$6>C2;A2:$A$6))-A2


            To type this formula in array mode, you need to type it as usual, but instead of pressing ENTER, you need to press CTRL+SHIFT+ENTER






            share|improve this answer























            • What does SI mean
              – Marco Vos
              Nov 8 at 13:39










            • @MarcoVos OMG!!! SI=IF. Thanks for that!. I posted the formula in spanish, and forgot the translation. tHANKS!
              – Foxfire And Burns And Burns
              Nov 8 at 15:52













            up vote
            0
            down vote










            up vote
            0
            down vote









            Ok, I did not post the answer waiting until OP answered why D5 is 1 instead of 0, but my formula is also an array formula. It would be:



            =MIN(IF(B2:$B$6>C2;A2:$A$6))-A2


            To type this formula in array mode, you need to type it as usual, but instead of pressing ENTER, you need to press CTRL+SHIFT+ENTER






            share|improve this answer














            Ok, I did not post the answer waiting until OP answered why D5 is 1 instead of 0, but my formula is also an array formula. It would be:



            =MIN(IF(B2:$B$6>C2;A2:$A$6))-A2


            To type this formula in array mode, you need to type it as usual, but instead of pressing ENTER, you need to press CTRL+SHIFT+ENTER







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 8 at 15:51

























            answered Nov 8 at 12:16









            Foxfire And Burns And Burns

            1,8581314




            1,8581314












            • What does SI mean
              – Marco Vos
              Nov 8 at 13:39










            • @MarcoVos OMG!!! SI=IF. Thanks for that!. I posted the formula in spanish, and forgot the translation. tHANKS!
              – Foxfire And Burns And Burns
              Nov 8 at 15:52


















            • What does SI mean
              – Marco Vos
              Nov 8 at 13:39










            • @MarcoVos OMG!!! SI=IF. Thanks for that!. I posted the formula in spanish, and forgot the translation. tHANKS!
              – Foxfire And Burns And Burns
              Nov 8 at 15:52
















            What does SI mean
            – Marco Vos
            Nov 8 at 13:39




            What does SI mean
            – Marco Vos
            Nov 8 at 13:39












            @MarcoVos OMG!!! SI=IF. Thanks for that!. I posted the formula in spanish, and forgot the translation. tHANKS!
            – Foxfire And Burns And Burns
            Nov 8 at 15:52




            @MarcoVos OMG!!! SI=IF. Thanks for that!. I posted the formula in spanish, and forgot the translation. tHANKS!
            – Foxfire And Burns And Burns
            Nov 8 at 15:52


















             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53204966%2fexcel-formula-to-find-the-first-higher-value%23new-answer', 'question_page');
            }
            );

            Post as a guest




















































































            Popular posts from this blog

            Schultheiß

            Verwaltungsgliederung Dänemarks

            Liste der Kulturdenkmale in Wilsdruff