Solved

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

Posted on 2012-12-30
5
274 Views
Last Modified: 2012-12-31
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
Comment
Question by:tru504187211
5 Comments
 
LVL 16

Expert Comment

by:terencino
ID: 38732003
Hi actually this looks good to me, with relative references for the A & B rows. Have you tried sorting it yet?
...Terry
0
 

Author Comment

by:tru504187211
ID: 38732046
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
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 38732066
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
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 38732068
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
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 38732124
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Subtraction 4 15
Capture ESC press reliably without error 2 31
Excel VBA User Form Help 21 26
Excel Need to return the text of a filter column 11 19
Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now