Find first value greater than a certain number in Excel

Asked

Viewed 13,312 times

2

Hello, good night

I wish my friends here could help me with this question. I have an Excel spreadsheet for calculation of steel reinforcements for concrete structures. By calculation, I find a value of steel area per m². From this value, I want to find in a list of predetermined values the one that suits me, that is, the first value greater or equal to the found. I can find the value with the SE function, only it gets huge and with several conditional, given the large amount of values. So if anyone knows in a simpler way, I’d appreciate it. Below follows images for better understanding:

Imagem_1

Imagem_2

P.S.: Remember that as I choose the steel gauge, I want a function that looks in a specific column. As I chose 10mm, the value found should be in Column S

  • What formula is currently used? And where do you choose the gauge? Any cells or in the formula?

  • I am not using any formula at the moment. I am manually choosing through the table query. I choose the gauge by means of Combo Box (Form Control). This choice gives me a number in the link cell, which will correspond to the column in which I will look for the value.

  • So you use VBA? code in the form? Edit the question with this information

  • No. It’s not an Activex control. I don’t know how to work with VBA.

  • As for the selected gauge there is no problem. What I want to solve is to find a function that compares the values of column S (say q the table has only one column, to simplify the understanding) with what I have, that is, that it compares from the lowest value (2,42) to the highest value (16,00)and return me the next higher than the calculated.

  • I tried to use PROCV, with Approximate Matching (since I don’t have the exact value of 8.86 in the column in question), but it always returns me the lowest value of this column (2.42), which is obviously lower than what I have (8.86).

Show 1 more comment

4 answers

2


SOLUTION FOUND: INDEX + CORRESP

Thank you very much to the friends who tried to solve my problem, but I managed to unravel, after a lot of breaking my head, since I had already tried to solve this same problem in other spreadsheets of mine and in more complicated tables than this, with several entries. The secret of the solution lies in the use of the function CORRESP, because with it, I can find in which line is the lowest value of steel area greater than calculated, simply using the TYPE OF CORRESPONDENCE -1(IS GREATER THAN), in the last argument of the formula. That way I use such value in the function INDEX, in which I have as matrix all my data, the line the value given by CORRESP and the column the value given by the cell linked to the Form Control, where the gauge is selected by the user, plus 1 unit

DETERMINATION OF THE EFFECTIVE STEEL AREA:

=SEERRO(ÍNDICE($N$5:$T$34;CORRESP(I21;SE(U12=1;$O$5:$O$34;SE(U12=2;$P$5:$P$34;SE(U12=3;$Q$5:$Q$34;SE(U12=4;$R$5:$R$34;SE(U12=5;$S$5:$S$34;SE(U12=6;$T$5:$T$34))))));-1);U12+1);"Selecione uma bitola de aço maior")

In function CORRESP of this formula, the user chooses a gauge, which corresponds to a number of the linked cell of the Form Control (Combobox - Not Control ACTIVEX). Thus, the 4.2mm gauge corresponds to index 1.5mm index 2 and so on. This will define the column in which the CORRESP will search. In general function INDEX, the last argument of the function that requests the column, where it contains the data that I want, is added a unit, because the user’s chosen gauge corresponds, in the table, to its index plus 1, that is, 4.2mm is index 1, but in the table is column 2, 5mm is index 2, but in the table is column 3 and so on (COLUMN=index+1). The function SEERRO was used for the case of the largest slatted steel area of the selected gauge is lower than the calculated one, asking the user to choose a larger gauge. The function CORRESP me, for the values highlighted below, the lines 9 and 13 of the table, respectively.

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

Of course that Table Auxiliary will not be viewed by the user, as well as the index of the gauge selection. I put for better understanding of what I did. I opted for the function INDEX at the beginning of PROCV because it allows me to search for data to the left and thus automatically determine the spacing of the bars (Column 1), which is another data that also interests me. Thus were used the same function above, with only modification of the last argument of the formula, which is now Table Column 1 (Spacing).

SPACING:

=SEERRO(ÍNDICE($N$5:$T$34;CORRESP(I21;SE(U12=1;$O$5:$O$34;SE(U12=2;$P$5:$P$34;SE(U12=3;$Q$5:$Q$34;SE(U12=4;$R$5:$R$34;SE(U12=5;$S$5:$S$34;SE(U12=6;$T$5:$T$34))))));-1);1);"─")

*OBS.: The formulas got big because I chose to put the formula CORRESP within the formula INDEX. But I could have done as I did initially, calculating the CORRESP in another cell and entering the function INDEX only with its numerical value.

1

I think this formula meets your need.

I created an auxiliary calculus cell so that the search is done correctly.

Auxiliary formula

=SE(+INT(X2)-X2<-0,5;ARRED.PARA.CIMA(X2;0);X2)

Search formula

=+PROCV(Y2;N:T;CORRESP(W2;N$2:T$2;0);3)

inserir a descrição da imagem aqui

Note: I did some tests and got the correct values, in case there is any error says to correct.

  • R.Galamba, thank you for your reply.

  • Regarding the value 8.86, when using its Auxiliary Formula, it works because in the hypothesis test, which gives TRUE, the result will be the rounding of this value (9.00), which matches the spacing (first column) and that coincidentally corresponds the line that contains the immediately higher value (8,89) than I want. So, when you play in PROCV the function will search on row 9 and in the column of the gauge, and returns the correct value.

  • However, when I tried another value, such as my initial question (6.50), by its Auxiliary Formula, the hypothesis test gives FALSE, and returns the value itself (6.50), which once again coincidentally matches the 6.5 cm spacing (line 4 of the table). Thus, when using the PROCV of the Search Formula, the function will do a search in the gauge column and in line 4, returning the value 13.33, when the right value would be 6.67 (line 13).

  • I managed to solve my problem with the INDEX+CORRESP Function. I can get the results I want.

  • @allanglayd I took the test with 6.5 and get the result 12.31 is not that the expected result?

1

The solution works, I do not know if it is with the best Golf Code possible. There is room to decrease this formula.

But with the data as in the following picture:

Tabela

Given a gauge and minimum value

In cell M6 the column with the gauge data (1 to 6 in row 4) and in cell M7 the calculation value (in example 6,1).

With the formula =MÍNIMO(SE(INDIRETO(ENDEREÇO(4;14+CORRESP(M6;O4:T4;0))&":"&ENDEREÇO(18;14+CORRESP(M6;O4:T4;0)))>=M7;INDIRETO(ENDEREÇO(4;14+CORRESP(M6;O4:T4;0))&":"&ENDEREÇO(18;14+CORRESP(M6;O4:T4;0))))) inserted with Ctrl+Shift+Enter

The result is to find in the column with the value of gauge 4, the lowest value greater than 6.1. That is 6.5.

Given a calculation, find the gauge

=INDIRETO(ENDEREÇO(4;MÍNIMO(SE(O5:T18>=M7;COL(O:T))))) inserted with Ctrl+Shift+Enter

Resultado

Find only in the column

To find in column S the calculation value in cell M7

=MÍNIMO(SE(S:S>=M7;S:S)) inserted with Ctrl+Shift+Enter

Resultado2

  • Thank you for the reply danieltakeshi. Your function works, but in order to not have to do the modoficações you said necessary, I will use the solution I found. I broke my head and found the solution using the INDEX+CORRESP Function. But I will give an analysis in these functions if I need in the future, mainly the functions INDIRECT and ADDRESS, which I never used. Thanks.

0

A matrix formula can be used to make all SE'If you didn’t have to write it all down, it would look like this:

{=minimo(se("16,00":"2,42">"8,86";"16,00":2,42"))}

Obs.: Replace the values with the corresponding cell without quotation marks, and use Ctrl+Shift+Enter to insert {}.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.