IF Cell G2=Payment and Cell H2 equals what is in another sheets range (A1-A41) then I2+J2 otherwise 0.00 Need for Payment, Overpayment, Credit and Re

DennisYoung

New Member
Joined
Jun 27, 2022
Messages
14
Office Version
  1. 2021
  2. 2016
Platform
  1. Windows
I am very new to formula's so please be kind.

I am doing a formula for Credit Card types and if it is a Payment or Overpayment or Credit or Return then add cells I2 (PaymentAmnt) and J2 (Subtotal) to cell R2

I have tried =IF(OR(EXACT(G2="Payment",H2=CCardTypes!$A$1:$A$41)),I2+J2,"0.00") and it gives me data but when I add the second nest =IF(OR(EXACT(G2="Payment",H2=CCardTypes!$A$1:$A$41)),I2+J2,IF(OR(EXACT(G2="Overpayment",H2=CCardTypes!$A$1:$A$41)),I2+J2,"0.00")) it puts amounts into all the cells even if it is not on the Credit Card list

1656433573946.png


1656433644452.png
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
To start, your syntax for EXACT is not correct. EXACT takes two text arguments, and returns TRUE if they are exactly the same. I do not know what you are intending when you use it like this:

Excel Formula:
EXACT(G2="Payment",H2=CCardTypes!$A$1:$A$41)

Let's get that cleared up first then see if there are other problems.
 
Upvote 0
Like I said I am very new to formulas in general. I have no clue what I am doing which is why I am here.

So, lets go with what I need

If G2 equals payment and H2 equals anything in the Credit Card list I need to Add I2 and J2 and put in R2
If G2 equals overpayment and H2 equals anything in the Credit Card list I need to Add I2 and J2 and put in R2
If G2 equals credit and H2 equals anything in the Credit Card list I need to Add I2 and J2 and put in R2
If G2 equals return and H2 equals anything in the Credit Card list I need to Add I2 and J2 and put in R2
otherwise 0.00 in R2

Not sure what you mean clear that up, all I know when I put in EXACT I do get some data without it not so much
 
Upvote 0
Use this formula in R2. You are using a table so it should fill down automatically.

Excel Formula:
=IF(ISERROR(MATCH(H2,CCardTypes!$A$1:$A$41,0)),0,IF(OR(G2={"Payment","Overpayment","Credit","Return"}),I2+J2,0))
 
Upvote 0
Solution
Glad it worked, since I didn't have data to test it :)

Reading your logic it was clear that in every case, the credit card had to be found. That is what the MATCH function does. I also showed a shortcut for comparing a cell to see if it matches any of several values.

Come to think of it this is the equivalent logic and is just a little simpler.

Excel Formula:
=IF(AND(ISNUMBER(MATCH(H2,CCardTypes!$A$1:$A$41,0)),OR(G2={"Payment","Overpayment","Credit","Return"})),I2+J2,0)
 
Upvote 0
One more question if I may?

How would you do one that does not match the list? Same scenario but add the same cells if there is not a match?
 
Upvote 0
In that case you are going to add the same numbers if it is in the list, or if it is not in the list. Therefore it doesn't matter if it's in the list. You just remove that condition.

Excel Formula:
=IF(ISNUMBER(MATCH(H2,CCardTypes!$A$1:$A$41,0)),I2+J2,0)
 
Upvote 0

Forum statistics

Threads
1,215,398
Messages
6,124,694
Members
449,179
Latest member
kfhw720

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