Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

Excel - Forumla to reference current row (even after rows get sorted)

I've got a cell, D2, that has this formula...

=COUNTIFS('WORKING DATA'!$C$2:$C$65000,'FINAL REPORT'!A2,'WORKING DATA'!$D$2:$D$65000,'FINAL REPORT'!$D$1,'WORKING DATA'!$E$2:$E$65000,'FINAL REPORT'!$B2)

...and it returns the correct information.  It is looking to match information from multiple worksheets to be able to count numbers.

So, if I sort all of the rows, this row may move down to say, D203, but the formula is static, so now it is still referencing A2 and B2, but it is no longer part of row 2...

How can I modify this formula for A2 and B2 to simply reference cells A and B of the current row that this formula is part of (as the information in that row's D column).

Thanks!!!
0
tru504187211
Asked:
tru504187211
1 Solution
 
terencinoCommented:
Hi actually this looks good to me, with relative references for the A & B rows. Have you tried sorting it yet?
...Terry
0
 
tru504187211Author Commented:
Hi Terry...I have.  I sort all columns and it moves the data, but keeps the A2 and B2 references no matter what row it is in...
0
 
Saqib Husain, SyedEngineerCommented:
Try this formula

=COUNT('Working data'!$C$2:$C$65000,INDIRECT(ADDRESS(ROW(),1,,,"Final report")),'Working data'!$D$2:$D$65000,'Final report'!$D$1,'Working data'!$E$2:$E$65000,'Final report'!$B2)


********edited*****
0
 
Saqib Husain, SyedEngineerCommented:
Or simply

=COUNT('Working data'!$C$2:$C$65000,INDIRECT(ADDRESS(ROW(),1)),'Working data'!$D$2:$D$65000,'Final report'!$D$1,'Working data'!$E$2:$E$65000,'Final report'!$B2)
0
 
Rory ArchibaldCommented:
I assume the formula is on the FINAL REPORT sheet? If so, remove the sheet name from the references to cells on that sheet:

=COUNTIFS('WORKING DATA'!$C$2:$C$65000,A6,'WORKING DATA'!$D$2:$D$65000,$D$1,'WORKING DATA'!$E$2:$E$65000,$B6)
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now