Karen Schaefer
asked on
Syntax help - translating actual column/field names to test sample SumProduct returning wrong value
I had this question after viewing For Loop for Excel 2016 vba.
I am attempting to modify the tested version to handle the actual column names in my worksheet and I am getting a #Value issue
The working version from the test sample.
Highlight number should be the new value, what am I missing. could it be the SumProduct returning wrong value
I am attempting to modify the tested version to handle the actual column names in my worksheet and I am getting a #Value issue
=IF(Country_Billing[agtno]=B1,qryDifference[agtno],SUMPRODUCT((qryDifference[agtno]=Country_Billing[agtno])*(qryDifference[Validate Adjustment]="Y")*qryDifference[Difference])+Country_Billing[agt_amt])
The working version from the test sample.
=IF([@agtno]=B1,qryDifference[agtno],SUMPRODUCT((Balance!$B$2:$B$7=[@agtno])*(Balance!$F$2:$F$7="Y")*Balance!$E$2:$E$7)+[@[agt_amt]])
Highlight number should be the new value, what am I missing. could it be the SumProduct returning wrong value
ASKER
what if the referencing of a table that is linked to another query. The table is based on an query, what is the proper syntax?
Problem seems to be with the +[@Column1] part in the formula.
Also qualify the cell references with Table Name e.g. change [@agentno] to country_results[@agentno] and same with other cell references in the formula.
Also qualify the cell references with Table Name e.g. change [@agentno] to country_results[@agentno] and same with other cell references in the formula.
ASKER
so How do I get the revised agt_amount? for the first instances of the AgentNo only?
=IF(qryDifference[agentno] =Country_r esults[age ntno],qryD ifference[ agentno],S UMPRODUCT( (qryDiffer ence[agent no]=Countr y_results[ @agentno]) *(qryDiffe rence[Vali date Adjustment]="Y")*qryDiffer ence[New Adj Amt])+Country_results[agt_ amt])
the new amount = First value per agentno plus the difference value on a different sheet within the same workbook. and if validataion is null then return the original value .
NOTE: The references are what the system places when I click on the column to make sure I have it correct.
I will also need to modify the tot_leads amount where the validation = Y.
=IF(qryDifference[agentno]
the new amount = First value per agentno plus the difference value on a different sheet within the same workbook. and if validataion is null then return the original value .
NOTE: The references are what the system places when I click on the column to make sure I have it correct.
I will also need to modify the tot_leads amount where the validation = Y.
Did the formula you posted in your last post work for you?
As I said the problem would be with +Country_results[agt_amt] part.
As I said the problem would be with +Country_results[agt_amt] part.
ASKER
it would return a result some times but not the correct value.
ASKER
Found solution with help of another ee posting.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
found the solution elsewhere on ee
=Country_Billing[agtno] should be =[Country_Billing@agtno] (this from same workbook)
=testsample.xlsx!Table1[@a
I see you are also missing some of the @ signs that identify table columns