Johnny C
Well-known Member
- Joined
- Nov 7, 2006
- Messages
- 1,069
- Office Version
- 365
- Platform
- Windows
I've inherited a column with formula that goes through two columns of unsorted data (from a PowerQuery) and tries to get values for them to use on SUMIFS.
The formula is :-
=IFERROR(INDEX('Consol 2'!$H$7:$H$2002,MATCH(0,COUNTIF($C$5:$C5,'Consol 2'!$H$7:$H$2002)+('Consol 2'!$D$7:$D$2002<>$B6)+('Consol 2'!$E$7:$E$2002<>Supplier),0)),"")
There's a Supplier picked from a drop-down list in the cell called 'Supplier'.
Column B has a service in which picks up correctly and Consol 2 column D has that service in.
Column H has a description in which can be blank.
On the first row, if the description has a blank in, the formula above returns a 0 - which the SUMIFS can't pick up on as the SUMIFS on the description is blank.
On subsequent rows, if the description has a blank in, the formula above returns a blank - which the SUMIFS can pick up on as the SUMIFS on the description is blank.
I'm sure it's something to do with the MATCH(0,COUNTIF($C$5:$C5,'Consol 2'!$H$7:$H$2002) as the value in C5 is a column header that will never appear in the list of descriptions, so just returns ar array of 0's, but subsequent rows e.g. MATCH(0,COUNTIF($C$5:$C6,'Consol 2'!$H$7:$H$2002) will be>0
Unfortunately I inherited this and don't have time for a rewrite as it's a huge model that will ultimately be maintained by the people who wrote it in the first place.
TIA
The formula is :-
=IFERROR(INDEX('Consol 2'!$H$7:$H$2002,MATCH(0,COUNTIF($C$5:$C5,'Consol 2'!$H$7:$H$2002)+('Consol 2'!$D$7:$D$2002<>$B6)+('Consol 2'!$E$7:$E$2002<>Supplier),0)),"")
There's a Supplier picked from a drop-down list in the cell called 'Supplier'.
Column B has a service in which picks up correctly and Consol 2 column D has that service in.
Column H has a description in which can be blank.
On the first row, if the description has a blank in, the formula above returns a 0 - which the SUMIFS can't pick up on as the SUMIFS on the description is blank.
On subsequent rows, if the description has a blank in, the formula above returns a blank - which the SUMIFS can pick up on as the SUMIFS on the description is blank.
I'm sure it's something to do with the MATCH(0,COUNTIF($C$5:$C5,'Consol 2'!$H$7:$H$2002) as the value in C5 is a column header that will never appear in the list of descriptions, so just returns ar array of 0's, but subsequent rows e.g. MATCH(0,COUNTIF($C$5:$C6,'Consol 2'!$H$7:$H$2002) will be>0
Unfortunately I inherited this and don't have time for a rewrite as it's a huge model that will ultimately be maintained by the people who wrote it in the first place.
TIA