简体   繁体   中英

Excel: Cross-workbook data mining

At work, we track our payments collected in an effort to reach a daily goal. As such, our payments are tracked in our individual Excel workbooks. An example of said workbook is below:

Google Docs Payment Log (modified)

We use Excel 2013 at work. I have a "Tracker Log" that is a separate workbook. Originally I had it tracking inside the existing workbook, but moved it to the outside workbook for ease of copy/paste for our team lead.

In the Tracker Log, I have the current workable days in Column A (dates occurring Monday through Friday for the month of August). Each day is supposed to list how many payments were collected and the sum of the payments. That part, I figured out from research and had the following formula with the Payment Log:

=IF(NOT(ISBLANK(A2)), COUNT(B2:INDEX(B2:$B$500,MATCH(TRUE,INDEX(B2:$B$500="",0),0))),"")

and a similar one for SUM. It worked great for its purpose, and I was pleased when it was in the Payment Log. Moving it to the Tracker Log, however, did not produce intended results. The formula works; it's not broken. The undesired result, however, is that instead of each line producing the day's information, the formula causes it to skip down to the corresponding row in the Payment Log. That is, instead of Row 2 being 8/1 and Row 3 being 8/2's information, Row 1 is 8/1 and the row that 8/2 falls on in the Payment Log is the row the Tracker log populates. (View Sheet2 to see the undesired behavior.)

What formula do I need to use for the desired behavior?

EDIT

After sneakily taking home the information (and modifying so no account information is released), I've found the selected answer does not work at all. See the (modified) Google Spreadsheet above to show what is happening.

For me to make it work, I need in B2:

=IFERROR(COUNTIF(INDEX(Sheet1!B:B,MATCH(A2,Sheet1!A:A,0)):INDEX(Sheet1!B:B,MATCH(TRUE,INDEX(Sheet1!B:B,MATCH(A2,Sheet1!A:A,0)):INDEX(Sheet1!B:B,MATCH(A2,Sheet1!A:A,0)+100)=0,0)),"<>"),"")

and in C2:

=IFERROR(SUM(INDEX(Sheet1!C:C,MATCH(A2,Sheet1!A:A,0)):INDEX(Sheet1!C:C,MATCH(TRUE,INDEX(Sheet1!B:B,MATCH(A2,Sheet1!A:A,0)):INDEX(Sheet1!B:B,MATCH(A2,Sheet1!A:A,0)+100)=0,0))),"")

And then copy down B2:C2.

This are array formulas and must be confirmed with ctrl + shift + enter .

EDIT there was just a small error in it :P

For B2:

=IFERROR(COUNTIF(INDEX('Sept 2016'!B:B,MATCH(A2,'Sept 2016'!A:A,0)):INDEX('Sept 2016'!B:B,MATCH(TRUE,INDEX('Sept 2016'!B:B,MATCH(A2,'Sept 2016'!A:A,0)):INDEX('Sept 2016'!B:B,MATCH(A2,'Sept 2016'!A:A,0)+100)=0,0)+MATCH(A2,'Sept 2016'!A:A,0)-2),"<>"),"")

and for C2:

=IFERROR(SUM(INDEX('Sept 2016'!C:C,MATCH(A2,'Sept 2016'!A:A,0)):INDEX('Sept 2016'!C:C,MATCH(TRUE,INDEX('Sept 2016'!B:B,MATCH(A2,'Sept 2016'!A:A,0)):INDEX('Sept 2016'!B:B,MATCH(A2,'Sept 2016'!A:A,0)+100)=0,0)+MATCH(A2,'Sept 2016'!A:A,0)-2)),"")

This are array formulas and must be confirmed with ctrl + shift + enter .

I missed the part to offset outcome of MATCH(TRUE,...,0) so the upper index will not count from row 1. Sorry for this.

The formulas from B2 and C2 can be copied down. Also used your sheet naming. ;)

EDIT 2

Theoretical COUNTIF cannot return TRUE . I suggest some different error which simply will not pop up on my excel (also google sheets). Please try this formula for B2:

=IFERROR(SUM((INDEX('Sept 2016'!B:B,MATCH(A2,'Sept 2016'!A:A,0)):INDEX('Sept 2016'!B:B,MATCH(TRUE,INDEX('Sept 2016'!B:B,MATCH(A2,'Sept 2016'!A:A,0)):INDEX('Sept 2016'!B:B,MATCH(A2,'Sept 2016'!A:A,0)+100)=0,0)+MATCH(A2,'Sept 2016'!A:A,0)-2)<>"")*1),"")

This is an array formula and must be confirmed with ctrl + shift + enter .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM