Hi,
I have a complex excel formula like this.
“=IFERROR(SUMIF(‘SheetName’!D:D, “=1”)/(SUMIF(‘SheetName’!D:D, “=1”) - SUMIF(‘SheetName’!D:D, “=-1”)), “”)”
“SheetName” is a dynamic value. How do I use this dynamic variable in excel formula
How do I use this in write cell activity.
When I paste this formula into expression editor. I see error “End of expression expected”
@Yoichi @Palaniyappan
You’re just missing a couple of double quotes. This might work:
“=IFERROR(SUMIF(‘"+SheetName+"’!D:D, "“=1”")/(SUMIF(‘"+SheetName+"’!D:D, "“=1"”) - SUMIF(‘"+SheetName+"’!D:D, "“=-1"”)), ""“”)"”
Yoichi
(Yoichi)
3
Hi,
How about to use String.Format as the following?
strFormula =“=IFERROR(SUMIF(‘{0}’!D:D, “”=1"”)/(SUMIF(‘{0}’!D:D, “”=1"“) - SUMIF(‘{0}’!D:D, “”=-1"”)), “”“”)"
Then
String.Format(strFormular,sheetname)
Sequence.xaml (7.5 KB)
Regards,
1 Like
When I paste this is write cell. I see error - " String Constraints must end with double quotes"
There was something with the double quote formatting causing to show compiler erros, I replaced all double quotes and this seems to work fine
"=IFERROR(SUMIF(‘"+ SheetName+"’!D:D, ""=1"")/(SUMIF(‘"+SheetName+"’!D:D, ""=1"") - SUMIF(‘"+SheetName+"’!D:D, ""=-1"")), """")"
On a side note: I believe @Yoichi 's approach is much better, so you can also consider it
1 Like
Thankyou @Yoichi @Edwin_Barahona. Really appreciate your help.
Both your solutions work great. 
system
(system)
Closed
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.