doublej_jj
Board Regular
- Joined
- Apr 9, 2010
- Messages
- 147
Windows XP / Windows 2007
I use SUMPRODUCT to pull data to a summary sheet based on the criteria of a date range and company name. The summary sheet can be an individual company or a consolidation of all companies, aka "All". I currently use the following formula where B13 is the company name.
=IF($B13="All",SUMPRODUCT((Date_H>=I$10)*(Date_H<=I$9)*(Company_H<>"")*(Cont_Disc_H="Cont")*(Rev_Types_H=$A13)*(Rev_Data_H)),SUMPRODUCT((Date_H>=I$10)*(Date_H<=I$9)*(Company_H=$B13)*(Cont_Disc_H="Cont")*(Rev_Types_H=$A13)*(Rev_Data_H)))
This formula does work. However, I want a simplified, more elegant and more easily read formula. Since the true and false results above are identical except for the company name, I have tried to nest the company condition in a single SUMPRODUCT using IF at the end to determine consolidated or individual.
=SUMPRODUCT((Date_H>=G$10)*(Date_H<=G$9)*(Cont_Disc_H="Cont")*(Rev_Types_H=$A13)*(Rev_Data_H)*(IF($B13="All",1,(Company_H=$B13))))
This works for the consolidate / ALL. However, it returns a value of zero for all other company names. I have ensured that the Company_H=$B13 is correct by deleting everything else in the IF statement and it is correct, also verifiable by the formula that works above.
So the bottom line is, "Can anyone tell me if there is a reason why this does not work?" Any assistance is appreciated!
Jeff
I use SUMPRODUCT to pull data to a summary sheet based on the criteria of a date range and company name. The summary sheet can be an individual company or a consolidation of all companies, aka "All". I currently use the following formula where B13 is the company name.
=IF($B13="All",SUMPRODUCT((Date_H>=I$10)*(Date_H<=I$9)*(Company_H<>"")*(Cont_Disc_H="Cont")*(Rev_Types_H=$A13)*(Rev_Data_H)),SUMPRODUCT((Date_H>=I$10)*(Date_H<=I$9)*(Company_H=$B13)*(Cont_Disc_H="Cont")*(Rev_Types_H=$A13)*(Rev_Data_H)))
This formula does work. However, I want a simplified, more elegant and more easily read formula. Since the true and false results above are identical except for the company name, I have tried to nest the company condition in a single SUMPRODUCT using IF at the end to determine consolidated or individual.
=SUMPRODUCT((Date_H>=G$10)*(Date_H<=G$9)*(Cont_Disc_H="Cont")*(Rev_Types_H=$A13)*(Rev_Data_H)*(IF($B13="All",1,(Company_H=$B13))))
This works for the consolidate / ALL. However, it returns a value of zero for all other company names. I have ensured that the Company_H=$B13 is correct by deleting everything else in the IF statement and it is correct, also verifiable by the formula that works above.
So the bottom line is, "Can anyone tell me if there is a reason why this does not work?" Any assistance is appreciated!
Jeff