Mar 09 2023 08:51 AM
Hello,
so i have this issue with my table:
i want my cell on the "result" table to calcul a different formula according to 2 criterias in a "database" table. i manage to rechercheV my formula so it appears in the cell, but the calcul of the formula is not happening
table "result" :
criteria 1 - criteria 2 - My cell
table database
column A : combinaison of criteria 1&2= 32 differentes lines
column B : 32 lines corresponding to 32 differents formula to apply in my cell depending on criteria 1&2 combinaison
so my formula was:
RECHERCHEV(CONCATENER([@criteria1];[@criteria2]);Tableaudatabase;2;FAUX))
(sorry my formula is in french)
but with this formula, my formula appears as a text and isn't calculated
which fonction do i use to make so my formula is calculated?
thanks to helpers + sorry for bad english
Mar 09 2023 12:43 PM
A formula should start with =
=RECHERCHEV(CONCATENER([@criteria1];[@criteria2]);Tableaudatabase;2;FAUX))
Does the first column of Tableaudatabase contain the combinations of the criteria without a space or other character in between?
Also make sure that the cell with the formula is not formatted as Text, but as (for example) General.
Mar 10 2023 01:03 AM
my formula did start wtih the equal sign
=RECHERCHEV(CONCATENER([@criteria1];[@criteria2]);Tableaudatabase;2;FAUX))
and it worked, as the formula now appearing is the one i wanted from the database table. but it appears as text and isn't calculated
Mar 10 2023 03:23 AM
Have you checked the remarks from my previous reply about the cell format and the Show Formulas button?
Mar 10 2023 05:32 AM
Mar 10 2023 07:05 AM
I am really sorry, but I can't visualize what you want.
Mar 23 2023 09:21 AM
@Hans Vogelaari made an excel sheet to explain what i need.
i'm open to new suggestion too.
translation of the french text inside :
"Hello,
I want to calculate my compliance box (yellow) automatically according to the result (variable) and according to the limits set for each combination of reference/test.
The source of the values is in the tab "sources of the formulas" and are recalled with the help of RECHERCHEV in this table for practicality.
The formula to be used for the calculation of conformity is also recalled on this sheet from the sheet "sources of formulas" and is different for each line and each result.
A big part of the work is done, but I can't manage to switch from "the cell contains a formula in text form" to "the cell calculates the formula stored in text".
Maybe it's a common syntax error, but I'm stuck at this point.
Any ideas?
Thanks in advance."
Mar 23 2023 12:17 PM
The attached version is a macro-enabled workbook; you will have to allow macros when you open it.
There is code in the worksheet module that will automatically change the Conformité formula if you change a cell in the Référence or Test columns.
Mar 24 2023 04:31 AM
Mar 24 2023 04:53 AM
If you clear a cell in the Conformité column, then change Référence or Test in the same row, the formula should reappear.
You write "if i change the formula used to calculate the conformity" - where do you change that formula?
Mar 24 2023 06:02 AM
Mar 24 2023 06:05 AM
Mar 24 2023 06:16 AM
Your function EVAL returns a fixed text string, not a formula.
Mar 24 2023 06:21 AM
Mar 24 2023 06:29 AM
(1) D2 contains a formula.
(2) I cleared D2.
(3) I changed B2, and as a result, D2 contains a formula again.
The formulas in column D will be updated when you change a value in columns B or C. To make then change when you edit a formula on the 'source des formules' sheet:
Right-click the sheet tab of the 'source des formules' sheet.
Select 'View Code' from the context menu.
Copy the following code into the worksheet module:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cl As Range
If Not Intersect(Me.ListObjects("Tableau6").DataBodyRange, Target) Is Nothing Then
For Each cl In Worksheets("résultats").ListObjects("Tableau2").ListColumns("Conformité").DataBodyRange
cl.Formula = "=" & cl.Offset(0, 4).Value
Next cl
End If
End Sub
Mar 24 2023 06:36 AM
Mar 24 2023 07:02 AM - edited Mar 24 2023 07:03 AM
This would be the formula in D2 if you don't want to use the code. But as you can see, it would be a nightmare to maintain:
=IFS(A2="Produit fini", IFS(B2="test1", IF([@Résultat]<=[@[Spec / limite sup]],"CF","NC"), B2="test2", IF(AND([@Résultat]<=[@[Spec / limite sup]],[@Résultat]>=[@[Spec /limite inf]]),"CF","NC"), B2="test3", IF([@Résultat]<=[@Vigilance],"CF",IF(AND([@Résultat]>[@Vigilance],[@Résultat]<=[@[Spec / limite sup]]),"VIGILANCE","NC"))), A2="Semi fini", IFS(B2="test1", IF([@Résultat]<=[@[Spec / limite sup]],"CF","NC"), B2="test2", IF(AND([@Résultat]<=[@[Spec / limite sup]],[@Résultat]>=[@[Spec /limite inf]]),"CF","NC"), B2="test3", IF(AND([@Résultat]>=[@[Spec /limite inf]],[@Résultat]<=[@Vigilance]),"CF",IF(AND([@Résultat]>[@Vigilance],[@Résultat]<=[@[Spec / limite sup]]),"VIGILANCE","NC"))), A2="Mat.Première", IFS(B2="test1", IF(AND(ISBLANK([@[Spec /limite inf]]),ISBLANK([@Vigilance]),ISBLANK([@[Spec / limite sup]])),"N/A","OSEF"), B2="test2", IF([@Résultat]>=[@[Spec /limite inf]],"CF","NC"), B2="test3", IF([@Résultat]<=[@Vigilance],"OK","N/A")))
In French:
=SI.CONDITIONS(A2="Produit fini"; SI.CONDITIONS(B2="test1"; SI([@Résultat]<=[@[Spec / limite sup]];"CF";"NC"); B2="test2"; SI(ET([@Résultat]<=[@[Spec / limite sup]];[@Résultat]>=[@[Spec /limite inf]]);"CF";"NC"); B2="test3"; SI([@Résultat]<=[@Vigilance];"CF";SI(ET([@Résultat]>[@Vigilance];[@Résultat]<=[@[Spec / limite sup]]);"VIGILANCE";"NC"))); A2="Semi fini"; SI.CONDITIONS(B2="test1"; SI([@Résultat]<=[@[Spec / limite sup]];"CF";"NC"); B2="test2"; SI(ET([@Résultat]<=[@[Spec / limite sup]];[@Résultat]>=[@[Spec /limite inf]]);"CF";"NC"); B2="test3"; SI(ET([@Résultat]>=[@[Spec /limite inf]];[@Résultat]<=[@Vigilance]);"CF";SI(ET([@Résultat]>[@Vigilance];[@Résultat]<=[@[Spec / limite sup]]);"VIGILANCE";"NC"))); A2="Mat.Première"; SI.CONDITIONS(B2="test1"; SI(ET(ESTVIDE([@[Spec /limite inf]]);ESTVIDE([@Vigilance]);ESTVIDE([@[Spec / limite sup]]));"N/A";"OSEF"); B2="test2"; SI([@Résultat]>=[@[Spec /limite inf]];"CF";"NC"); B2="test3"; SI([@Résultat]<=[@Vigilance];"OK";"N/A")))
Mar 24 2023 09:20 AM
@Hans Vogelaari send you back the files with yellow and blue colors to show the problem
Mar 24 2023 09:28 AM
Mar 24 2023 12:20 PM
I don't see blue colors. Here is the workbook with the formula.