Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Assemble contents of two tables into one

Hi folks. I'm looking for a way to fill in a table automatically with the contents of two other tables. I'm creating a payment record and deposit slip. Information is typed into one of two tables: one for patient payments, or one for insurance payments. I'd like the deposit slip table to contain the information from the other two tables. For instance, if there are two entries in the "patients" table, and one in the "insurance" table, the deposits table would contain three entries. Further, these values need to be rows one, two and three of the deposit table.


To put it another way, I would like to be able to sort my entries by typing into two different tables, but generate a third table with those entries unsorted.


I appreciate any assistance and ideas.


Jeremy

MacBook Pro 2.2 Ghz, Mac OS X (10.6.2)

Posted on Mar 28, 2015 11:29 AM

Reply
6 replies

Mar 28, 2015 1:13 PM in response to Jeremy Hansen

Hi Jeremy,


What you want to do can certainly be done. I think you need to visualize more completely how you want these tables to look and work.

If the deposit slip is a weekly thing it will need to work one way; if deposits are made whenever or monthly, how entries get pulled to the deposit table will differ.

Does it matter if the patients are grouped and then the insurance? I am not sure what you mean by "unsorted".

How many payments are made in a single period?


quinn

Mar 28, 2015 2:59 PM in response to t quinn

Thanks for the reply, Quinn.


As far as layout, the document is in landscape, and I made a deposit slip at one end, and then two tables in the remaining space. This way I can print it, cut off the deposit slip, and keep the other for records. Our records need to have payments from patients separate from payments from insurance (i.e. put Check #100 from John Smith in table A, Check #28484824 from Blue Cross in table B.) The deposit slip would include everything, in no particular order, which is what I mean by unsorted. If I had 15 lines in each source table, and thirty or so on the deposit slip, that would be enough for this sheet. The secretary would fill in the tables as checks arrive throughout the week, and then print this at the end of the week for a Friday deposit.


I could directly link the cells, but that would mean that entries on Table A would be items 1-15 on the slip, and entries on Table B would be 16-30, even if there were empty lines above. I'm trying to avoid that.

Mar 29, 2015 7:13 AM in response to Jeremy Hansen

Hi Jeremy,


I could directly link the cells, but that would mean that entries on Table A would be items 1-15 on the slip, and entries on Table B would be 16-30, even if there were empty lines above. I'm trying to avoid that.

So if it is practical for you to link the spreadsheets directly that is really the cleanest way to go. Any solution that I propose will have a table with 32 rows for potential data. The piece that will make it work for you is a filter that only shows rows that have values that have been brought over. I would have been suggesting one anyway. The filter can be left on and the deposit table will adjust automatically.

User uploaded file

quinn

Mar 29, 2015 1:30 PM in response to t quinn

I figured it out myself. Thanks. Bye!


No, just kidding. Can you imagine?


Okay, here is what I came up with. First, a prose explanation of the functions I used. This formula is in the deposit slip. Remember, Table A is insurance checks, Table B is patient checks.

1. Use COUNTIF on the entries in Table A, to find how many items are in Table A.

2. Get my row number (actually, my row number minus 5 because I don't start listing checks until line 5 of the deposit slip)

3. IF(my row is less than or equal to the number of items in table A) then (use the value from table A in the same row as mine) else (use the value from table B in the same row as mine minus the number of items in table A)


So, if my row number is two, and there are at least two items in table A, then use the value from table A row two. If I am row seven, and there are three items in table A, use table B row 4.


I then wrapped another IF statement around it to change "0" to a blank, if it returned zero, and an IFERROR around all of that, because the references eventually got out of range.


Here it is:

IFERROR(IF(IF((ROW(B5)−5)<(COUNTIF(Checks from Insurance::$E$2:$E$31,">0")),Checks from Insurance::E2,(INDEX(Checks from Patients::$E$2:$E$20,(ROW(B5)−4)−(COUNTIF(Checks from Insurance::$E$2:$E$31,">0")))))=0,"",IF((ROW(B5)−5)<(COUNTIF(Checks from Insurance::$E$2:$E$31,">0")),Checks from Insurance::E2,(INDEX(Checks from Patients::$E$2:$E$20,(ROW(B5)−4)−(COUNTIF(Checks from Insurance::$E$2:$E$31,">0")))))),"")


Here is the function without the zero catching and error catching statement:

IF((ROW()−5)<(COUNTIF(Checks from Insurance::$E$2:$E$31,">0")),Checks from Insurance::B2,(INDEX(Checks from Patients::$B$2:$B$20,(ROW()−4)−(COUNTIF(Checks from Insurance::$E$2:$E$31,">0")))))


I also wrote a conditional statement so that the "Total number of items" box counts the checks, but counts currency and coins as only one item.


Here is a screenshot.

User uploaded file

If you delete that BlueCross entry, John and Betty would immediately move up a row.

Mar 29, 2015 2:31 PM in response to Jeremy Hansen

EDIT: I just altered it, to use INDEX to find the right cell in Table A as well as Table B. I like uniformity.


=IFERROR(IF(IF((ROW()−5)<(COUNTIF(Checks from Insurance::$E$2:$E$31,">0")),INDEX(Checks from Insurance::$E$2:$E$31,ROW()−4),(INDEX(Checks from Patients::$E$2:$E$20,(ROW()−4)−(COUNTIF(Checks from Insurance::$E$2:$E$31,">0")))))=0,"",IF((ROW()−5)<(COUNTIF(Checks from Insurance::$E$2:$E$31,">0")),INDEX(Checks from Insurance::$E$2:$E$31,ROW()−4),(INDEX(Checks from Patients::$E$2:$E$20,(ROW()−4)−(COUNTIF(Checks from Insurance::$E$2:$E$31,">0")))))),"")

Mar 29, 2015 10:03 PM in response to Jeremy Hansen

Hi Jeremy,


Congrats on finding a solution! The screenshot really helped to illustrate your problem. I think my approach shares something with yours. INDEX() is key.

User uploaded file


B6 =IF(LEN(ChecksFromInsurance::B2)>0,ChecksFromInsurance::B2,IF(LEN(INDEX(ChecksF romPatients::B,ROW(cell)−COUNTA(ChecksFromInsurance::B)−4,1,area-index))>0,INDEX (ChecksFromPatients::B,ROW(cell)−COUNTA(ChecksFromInsurance::B)−4,1,area-index), ""))

You might like this approach because you can fill it across and once you adjust the ChecksFromPatients column you can fill them both down.

I am using LEN() to check for data in cells. COUNTA() counts any cell that has data. It doesn't need an error trap and it fails in an interesting way if the last insurance check's value is not posted. You can ignore my index values- an early attempt.


Let me know what you think.


quinn

Assemble contents of two tables into one

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.