Problem with multiple IF statements and lookup function

Mldeuser

Well-known Member
Joined
Dec 27, 2008
Messages
573
Office Version
  1. 365
Platform
  1. Windows
Hello

I am using the following formula to bring back the amount paid from the payment tab to the data tab. My problem is when there are two payments it brings back the earliest payment not the most current payment.

For example if a payment was made on 05/15/18 and 06/05/18 I would like it to bring back the amount paid on 06/05/18. I

=IF(J7="",0,IF(H7=W7,0,IF(J7<=$A$1,IFERROR(LOOKUP(9.99999999999999E+307,SEARCH($A7,Payment!A:A),Payment!P:P),0),0)))

The formula in in column V on the Data tab.

Column J = Date paid
Column H = Invoice Amount
Column W = Payment Next Month
Column A = The account Number

On the Payment tab

Column A = Account Number
Column P = Amount Paid
Column L = Date paid - this column is not currently being used and I am not sure how to add it.

Thank you
Mark
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
is it just column L you are looking for? does the below work?

=IF(J7="",0,IF(H7=W7,0,IF(J7<=$A$1,IFERROR(LOOKUP(9.99999999999999E+307,1/(Payment!A:A=A7),Payment!L:L),0),0)))
 
Upvote 0
I am looking to bring back the amount in column P on the payment tab where column A and Column J on both tabs are the same.
 
Upvote 0
can you try:

=LOOKUP(1,1/(Payment!A:A=A7)*(Payment!J:J=J7),Payment!P:P)
 
Upvote 0
It brought back the payment dated 05/18/18 not the payment on 06/15/18
 
Upvote 0
should be

=LOOKUP(
9.99999999999999E+307,1/(Payment!A:A=A7)*(Payment!J:J=J7),Payment!P:P)
 
Upvote 0
First occurrence...

Control+shift+enter, not just enter...

=INDEX(Payment!$P$2:$P$1000,MATCH(J2,IF(Payment!$A$2:$A$1000=$A2,Payment!$L$2:$L$1000),0))

Last occurrence (if dates in L of Payment are chronological), just enter...

=LOOKUP(9.99999999999999E+307,1/((Payment!$A$2:$A$1000=$A2)*(Payment!$L$2:$L$1000=$J2)),Payment!$P$2:$P$1000)
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,557
Latest member
richa mishra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top