Forum Discussion
Werner_Geiger
Sep 23, 2021Brass Contributor
How to assign and reuse a temporary name within a formula?
If you have a complex formula, e.g. (Sorry for German language. Should be understandable anyway😞
=WENN(ISTZAHL(
VERGLEICH(FALSCH;BEREICH.VERSCHIEBEN(daten;1;0;ZEILEN(daten)-1)>=daten;0));
"Datum nicht sortiert! Z(" &
VERGLEICH(FALSCH;BEREICH.VERSCHIEBEN(daten;1;0;ZEILEN(daten)-1)>=daten;0)+1+HeadRow & ")";"")
then it would be nice to assign a temporay name tmp and reuse it. This would look like:
=WENN(ISTZAHL(
tmp=VERGLEICH(FALSCH;BEREICH.VERSCHIEBEN(daten;1;0;ZEILEN(daten)-1)>=daten;0));
"Datum nicht sortiert! Z(" &
tmp+1+HeadRow & ")";"")
Is this possible?
ps: This example searches a column daten for the first not ascending element.
- Yes it is! Have a look at the LET function (does require Office 365 though): https://support.microsoft.com/en-us/office/let-function-34842dd8-b92b-4d3f-b325-b8b8f9908999
2 Replies
- JKPieterseSilver ContributorYes it is! Have a look at the LET function (does require Office 365 though): https://support.microsoft.com/en-us/office/let-function-34842dd8-b92b-4d3f-b325-b8b8f9908999
- Werner_GeigerBrass Contributor
JKPieterse
Great, thanks a lot! This does the job:=LET(tmp; VERGLEICH(FALSCH;BEREICH.VERSCHIEBEN(daten;1;0;ZEILEN(daten)-1)>=daten;0); WENN(ISTZAHL(tmp);"Datum nicht sortiert! Z(" & tmp+1+HeadRow & ")";""))
I think I read about this (new) LET before but forgot about it.