Have I overcomplicated this formula?

Wishmaster89

Board Regular
Joined
Jan 10, 2022
Messages
77
Office Version
  1. 2021
  2. 2019
  3. 2016
Platform
  1. Windows
  2. MacOS
Hi Everyone

I've written a formula in column AC that looks up the id number in column D on the "operations team orders" sheet and then checks to see if the shipment dates month ( column I) matches the order date month on the "operations team orders" sheet. In most cases orders are shipped within 5 days of ordering so that's why in the formula it is "ordDate+5".

What i am wondering is have i over complicated this formula and secondly i was worried that the sumif was going to ignore the if statements i have applied even though the sum if only happens if those conditions are met.

Is there a better way to do this formula?

Note: ignore column H on the first sheet, despite being named 'order date' its irrelavent.


CI invoices stuff.xlsx
ABCDEFGHIJKLMNOPQRSTUVWAC
1Posting DateDocument No.Line No.Sell-to Customer No.No.Order No.Customer Reference NoOrder DateShipment DateDescriptionQuantityUnit PriceVAT %AmountVATAmount Including VATBill-to Customer No.Sell-to Customer NameForenameSurnameOrder totalOrders sheet totalDifferenceAmount from orders sheet
230/06/2023test1880000001770110HLM3_QUESTION_PACK30/06/202306/06/2023test129.1720£21.60£4.32£25.92COLQQLtesttest nametest name222.3231.89.5£231.80
330/06/2023test1930000001775028DM80_EKEY_FACTS30/06/202306/06/2023test1300£27.00£0.00£27.00COLQQLtesttest nametest name438.3411.3-27£411.30
430/06/2023test2060000001819431LM85_EKEY_FACTS30/06/202306/06/2023test1300£27.00£0.00£27.00COLQQLtesttest nametest name438.3411.3-27£411.30
530/06/2023test2150000001835987F1342030/06/202316/06/2023test180£8.00£0.00£8.00COLQQLtesttest nametest name250.1251.71.6£259.70
CI export
Cell Formulas
RangeFormula
V2:V5V2=SUMIF('[Copy of COLQQL 06072023 JULY.xlsx]Orders'!$D$5:$D$2211,D2,'[Copy of COLQQL 06072023 JULY.xlsx]Orders'!$K$5:$K$2211)
W2:W5W2=V2-U2
AC2:AC5AC2=LET(ordDate,XLOOKUP(D2&MONTH(I2),'Operations team orders'!$D$2:$D$5&MONTH('Operations team orders'!$A$2:$A$5),'Operations team orders'!$A$2:$A$5),IF(OR(ordDate=I2,I2<=ordDate+5),SUMIF('Operations team orders'!$D$1:$D$5,'CI export'!D2,'Operations team orders'!$I$1:$I$5),"not in range"))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
W2:W5Cell Value<>0textNO
W2:W5Cell Value=0textNO


CI invoices stuff.xlsx
ABCDEFGHI
1Date of orderLearner first nameLearner surnameCII PINCII member/Non-memberpricepostageprice with vat
201/06/2023testtest001770110Htestmember231.80231.8
301/06/2023testtest001775028Dtestmember411.30411.3
401/06/2023testtest001819431Ltestmember411.30411.3
512/06/2023testtest001835987Ftestmember251.78259.7
Operations team orders
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hi, you have references to another workbook in your formulas:
'[Copy of COLQQL 06072023 JULY.xlsx] What kind of data is this?
 
Upvote 0
Hi, you have references to another workbook in your formulas:
'[Copy of COLQQL 06072023 JULY.xlsx] What kind of data is this?

Hi , thanks for pointing that out. Please ignore it, its only the formulas in column AC i'm asking about :)
 
Upvote 0
Hi, after I looked at it some more I have more questions.
You talk about just comparing MONTHS/5 Days from a Date, but you don't have a BOOLEAN exprssion in AC it calculates something. What does that do.
I've consolidated your two sheets into one worksheet:

Mr excel questions 53.xlsm
ABCDEFGHI
1Date of orderLearner first nameLearner surnameCII PINCII member/Non-memberpricepostageprice with vat
22023-06-01testtest001770110Htestmember231.80231.8
32023-06-01testtest001775028Dtestmember411.30411.3
42023-06-01testtest001819431Ltestmember411.30411.3
52023-06-12testtest001835987Ftestmember251.78259.7
6
7DIAC
8Sell-to Customer No.Shipment DateAmount from orders sheet
9001770110H2023-06-06FALSE=(XLOOKUP($A9,$D$2:$D$5,MONTH($A$2:$A$5))+5)>=B9
10001775028D2023-06-06FALSE=(XLOOKUP($A10,$D$2:$D$5,MONTH($A$2:$A$5))+5)>=B10
11001819431L2023-06-06FALSE=(XLOOKUP($A11,$D$2:$D$5,MONTH($A$2:$A$5))+5)>=B11
12001835987F2023-06-16FALSE=(XLOOKUP($A12,$D$2:$D$5,MONTH($A$2:$A$5))+5)>=B12
Wishmaster89
Cell Formulas
RangeFormula
C9:C12C9=(XLOOKUP($A9,$D$2:$D$5,MONTH($A$2:$A$5))+5)>=B9
D9:D12D9=FORMULATEXT(C9)
 
Upvote 0
Hi, after I looked at it some more I have more questions.
You talk about just comparing MONTHS/5 Days from a Date, but you don't have a BOOLEAN exprssion in AC it calculates something. What does that do.
I've consolidated your two sheets into one worksheet:

Mr excel questions 53.xlsm
ABCDEFGHI
1Date of orderLearner first nameLearner surnameCII PINCII member/Non-memberpricepostageprice with vat
22023-06-01testtest001770110Htestmember231.80231.8
32023-06-01testtest001775028Dtestmember411.30411.3
42023-06-01testtest001819431Ltestmember411.30411.3
52023-06-12testtest001835987Ftestmember251.78259.7
6
7DIAC
8Sell-to Customer No.Shipment DateAmount from orders sheet
9001770110H2023-06-06FALSE=(XLOOKUP($A9,$D$2:$D$5,MONTH($A$2:$A$5))+5)>=B9
10001775028D2023-06-06FALSE=(XLOOKUP($A10,$D$2:$D$5,MONTH($A$2:$A$5))+5)>=B10
11001819431L2023-06-06FALSE=(XLOOKUP($A11,$D$2:$D$5,MONTH($A$2:$A$5))+5)>=B11
12001835987F2023-06-16FALSE=(XLOOKUP($A12,$D$2:$D$5,MONTH($A$2:$A$5))+5)>=B12
Wishmaster89
Cell Formulas
RangeFormula
C9:C12C9=(XLOOKUP($A9,$D$2:$D$5,MONTH($A$2:$A$5))+5)>=B9
D9:D12D9=FORMULATEXT(C9)

Thanks for taking the time to look some more. So the formula is looking up the id number and order date from the orders sheet. If the ID and month both match then it will add 5 days to that order date and if the shipping date is equal to or less than the order date it will do a sumif on the orders sheet column I by CII Pin number ( column D )

The reason for the +5 days is because the shipping date is usually no more than 5 days from the order date but its never on the same day so you couldn't do "if order date equals shipping date"

Hope this helps
 
Upvote 0
Thanks for taking the time to look some more. So the formula is looking up the id number and order date from the orders sheet. If the ID and month both match then it will add 5 days to that order date and if the shipping date is equal to or less than the order date it will do a sumif on the orders sheet column I by CII Pin number ( column D )

The reason for the +5 days is because the shipping date is usually no more than 5 days from the order date but its never on the same day so you couldn't do "if order date equals shipping date"

Hope this helps

How does this work:
Depending on which version of excel you use, you may need to use the SUMPRODUCT function instead of SUM, and you may need to 'commit" the formula as an array formula by using the CNTL-SHFT-ENTR keystroke combinatio. There are examples of all three methods below.

Mr excel questions 53.xlsm
ABCDEFGHI
1Date of orderLearner first nameLearner surnameCII PINCII member/Non-memberpricepostageprice with vat
22023-06-01testtest001770110Htestmember231.80231.8
32023-06-01testtest001775028Dtestmember5000550
42023-06-01testtest001775028Dtestmember5000550
52023-05-01testtest001819431Ltestmember411.30411.3
62023-06-12testtest001835987Ftestmember251.78259.7
7
8DIAC
9Sell-to Customer No.Shipment DateAmount from orders sheet
10001770110H2023-06-06231.8= IF(SUM(($A$2:$A$6+5>=B10) * ($D$2:$D$6=A10))< 1,"Not In Range", SUM(($A$2:$A$6+5>=B10) * ($D$2:$D$6=A10) * ($I$2:$I$6)))
11001775028D2023-06-061100{= IF(SUM(($A$2:$A$6+5>=B11) * ($D$2:$D$6=A11))< 1,"Not In Range", SUM(($A$2:$A$6+5>=B11) * ($D$2:$D$6=A11) * ($I$2:$I$6)))}
12001819431L2023-06-06Not In Range= IF(SUMPRODUCT(($A$2:$A$6+5>=B12) * ($D$2:$D$6=A12))< 1,"Not In Range", SUMPRODUCT(($A$2:$A$6+5>=B12) * ($D$2:$D$6=A12) * ($I$2:$I$6)))
13001835987F2023-06-16259.7= IF(SUMPRODUCT(($A$2:$A$6+5>=B13) * ($D$2:$D$6=A13))< 1,"Not In Range", SUMPRODUCT(($A$2:$A$6+5>=B13) * ($D$2:$D$6=A13) * ($I$2:$I$6)))
Wishmaster89
Cell Formulas
RangeFormula
C10C10= IF(SUM(($A$2:$A$6+5>=B10) * ($D$2:$D$6=A10))< 1,"Not In Range", SUM(($A$2:$A$6+5>=B10) * ($D$2:$D$6=A10) * ($I$2:$I$6)))
D10:D13D10=FORMULATEXT(C10)
C11C11= IF(SUM(($A$2:$A$6+5>=B11) * ($D$2:$D$6=A11))< 1,"Not In Range", SUM(($A$2:$A$6+5>=B11) * ($D$2:$D$6=A11) * ($I$2:$I$6)))
C12:C13C12= IF(SUMPRODUCT(($A$2:$A$6+5>=B12) * ($D$2:$D$6=A12))< 1,"Not In Range", SUMPRODUCT(($A$2:$A$6+5>=B12) * ($D$2:$D$6=A12) * ($I$2:$I$6)))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,632
Latest member
jladair

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