r/learnexcel • u/nisardo27 • Jan 05 '22
Help with Excel IF function
Dear Community,
I would like to create and If statement with multiple AND conditions in order to determine the total inventory of a product.
I need the following conditions met in the IF statement:
- Inventory date (Row G)
- Item Code (Row C)
- Location (Row E)
- Order (remove products) or shipment (add products) (Row F)
I have to repeat these several times for different items, locations and dates.
If these conditions are fufilled, I would like the values shown in D (number of products) to be added to a table on another spreadsheet called "Inventory". In the example Ive included Ive just used cell J4 for the sake of simplecity.
So far Ive created the following function (which appears to be false as all conditions are fufilled yet no change the inventory number is observed in row J.
=IF(AND(G4="23/08/2020", C4="DEF",E4="732",F4="Order"),J4+D4,J4-D4)
Any help is much appreciated!
View all comments
Show parent comment
1
u/nisardo27 Jan 06 '22
Hi there, ty for the response.
This works: =IF(AND(TEXT(G4,"dd/mm/yyyy")="23/08/2020", C4="DEF",E4="732",F4="Order"),J4+D4,J4-D4)
is there a way for it to cycle through a longer list and pull out the values that apply to these conditions, then sum these up in another worksheet?
Say my first worksheet is called orders, which has entries from rows 4-205 something like this:
=IF(AND(TEXT('orders'!G4:G205,"dd/mm/yyyy")="23/08/2020", 'orders'!C4:205="DEF",'orders'!E4:205="732",'orders'!F4:F205="Order"),J4+D4,J4-D4)
The J4+D4 part would then be where I create a sum of the product inventory across the entire list