IF Formula

ferr

New Member
Joined
Jun 9, 2022
Messages
24
Office Version
  1. 365
Platform
  1. Windows
Can you please help with a formula that does the following for the screenshot attached?

if sum(E4:I4)<E12, give E12-SUM(E4:I4)
IF SUM(E4:I4)>E12, give E12-E4
but IF E4="" , give E12-F4
IF F4="", give E12-G4
IF G4="", give E12-H4
IF H4="", give E12-I4
 

Attachments

  • image001.png
    image001.png
    5.3 KB · Views: 23

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
is that the order you want them in
What happens if both F4 and H4 are blank ?

Also if the SUM(E4:I4 = E12 what do you want ?

A Nested IF will work left to right in order , so i have done in your order apart from the
but IF E4="" , give E12-F4
I have put that first

IF( E4="" , E12-F4 , IF (sum(E4:I4)<E12, E12-SUM(E4:I4) , IF (SUM(E4:I4)>E12, E12-E4, IF( F4="", E12-G4 , IF (G4="", E12-H4, IF (H4="", E12-I4, "What to do if none match"))))))

=IF(E4="",E12-F4,IF(SUM(E4:I4)<E12,E12-SUM(E4:I4),IF(SUM(E4:I4)>E12,E12-E4,IF(F4="",E12-G4,IF(G4="",E12-H4,IF(H4="",E12-I4,"What to do if none match"))))))

BUT i suspect this may not be the result you want

Note: Images are difficult to see , and also requires that I input all the data myself, which is very time consuming.

A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC , then put the sample spreadsheet onto a share
I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed
 
Upvote 0
Yes, that’s the order.
if the SUM(E4:I4 = E12) give E12-SUM(E4:I4)

E4="" , give E12-F4
IF F4="", give E12-G4
IF G4="", give E12-H4
IF H4="", give E12-I4

But if all are blank i.e E4:H4=“”, then give E12.
 
Upvote 0
=If( AND( E4="", F4="",G4="", H4="") , E12, IF(E4="",E12-F4,IF(SUM(E4:I4)<=E12,E12-SUM(E4:I4),IF(SUM(E4:I4)>E12,E12-E4,IF(F4="",E12-G4,IF(G4="",E12-H4,IF(H4="",E12-I4,"What to do if none match")))))))
 
Upvote 0
Solution

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

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