Formula help with removing duplicates while looking at other column criteria

samide2001

New Member
Joined
Feb 2, 2024
Messages
11
Office Version
  1. 365
Platform
  1. MacOS
All of the formulas I am doing will be on a summary tab that looks at data added on monthly tabs "Jan", "Feb", etc. . So I cannot add helper columns. The number of rows per column will change, and the number of duplicates will also change. So, if the formula could be derived to look at the entire column that would be great! I may not be the only end-user of the spreadsheet. The end-user will be downloading the data, copy/pasting into the monthly tabs, and then the formulas should hopefully auto-populate the monthly summary for them.

On the summary tab, I need the formula to look at the data on the associated tab column A and for each unique ID number I need to look at column Y and subtract the amount in column W if column B has "canceled" AND column AA is blank.

So for the data set below, there are 5 "canceled" instances in Column B, but only 3 of them have a blank cell in Column AA, and of those 3 there are only 2 unique IDs in Column A. So the result would be $28.27

2023 - TikTokShop Spreadsheet.xlsx
ABWXYZAA
1Order IDOrder StatusTaxesOrder AmountOrder Refund AmountCreated TimePaid Time
2Platform unique order ID.Current order status.Order total amount paid by the buyer.Order total refund amount of all returned SKUs.Order created time.Order paid time.
3576473553911582988Completed1.5212.0207/31/2023 6:14:07 PM07/31/2023 6:14:10 PM
4576473470461448948Completed1.2224.2207/31/2023 10:38:19 AM07/31/2023 10:38:22 AM
5576473470461448948Completed1.2224.2207/31/2023 10:38:19 AM07/31/2023 10:38:22 AM
6576473441536020829Completed0.514.4907/31/2023 8:11:24 AM07/31/2023 8:11:27 AM
7576473423026557177Completed1.0916.0907/31/2023 6:35:14 AM07/31/2023 6:35:17 AM
8576473308230422775Completed1.0516.0507/30/2023 6:26:15 PM07/30/2023 6:26:48 PM
9576473303896003495Completed0.615.607/30/2023 5:45:11 PM07/30/2023 5:45:35 PM
10576473291302408951Completed1.0911.5907/30/2023 4:47:56 PM07/30/2023 4:47:59 PM
11576473221986357846Completed1.1617.1507/30/2023 10:15:21 AM07/30/2023 10:15:24 AM
12576473223449055830Completed1.3820.3707/30/2023 10:13:48 AM07/30/2023 10:13:51 AM
13576473222655545942Completed1.5222.5107/30/2023 10:06:41 AM07/30/2023 10:06:44 AM
14576473201202336383Canceled1.4722.4616.0507/30/2023 8:23:02 AM
15576473198163628143Canceled1.6826.6716.0107/30/2023 8:18:43 AM07/30/2023 8:19:38 AM
16576473198163628143Canceled1.6826.674.2707/30/2023 8:18:43 AM07/30/2023 8:19:38 AM
107576472282577736405Completed1.4311.9307/26/2023 6:16:51 PM07/26/2023 6:16:54 PM
108576472272126316567Canceled2.6232.6216.3107/26/2023 5:36:22 PM
109576472272126316567Canceled2.6232.6216.3107/26/2023 5:36:22 PM
110576472273471377665Completed1.8114.0607/26/2023 5:31:15 PM07/26/2023 5:34:48 PM
Jul
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
So I cannot add helper columns
Helper columns are not required but you can create a new sheet that consolidates all the data from 12 sheets after that life would be much easy for you. The more complicated formula you create or use chances are to make some mistake. Or Just in case you need a slight modification it shall become a headache.

So My suggestion is to create a consolidated data sheet and then make a summary.
 
Upvote 0
Helper columns are not required but you can create a new sheet that consolidates all the data from 12 sheets after that life would be much easy for you. The more complicated formula you create or use chances are to make some mistake. Or Just in case you need a slight modification it shall become a headache.

So My suggestion is to create a consolidated data sheet and then make a summary.
This isn't the only formula on the summary sheet, so if I can get by without the helper consolidated sheet that would be ideal. I don't want numerous helper tab sheets running because then I run the risk of the other end-users messing with those sheets. Or even messing with the one helper consolidated sheet. The less people can mess with the end file the better.

But if that is the only way, then that is what I will do. But I am sure there is a formula that can work.
 
Upvote 0
All of the formulas I am doing will be on a summary tab that looks at data added on monthly tabs "Jan", "Feb", etc. . So I cannot add helper columns. The number of rows per column will change, and the number of duplicates will also change. So, if the formula could be derived to look at the entire column that would be great! I may not be the only end-user of the spreadsheet. The end-user will be downloading the data, copy/pasting into the monthly tabs, and then the formulas should hopefully auto-populate the monthly summary for them.

On the summary tab, I need the formula to look at the data on the associated tab column A and for each unique ID number I need to look at column Y and subtract the amount in column W if column B has "canceled" AND column AA is blank.

So for the data set below, there are 5 "canceled" instances in Column B, but only 3 of them have a blank cell in Column AA, and of those 3 there are only 2 unique IDs in Column A. So the result would be $28.27

2023 - TikTokShop Spreadsheet.xlsx
ABWXYZAA
1Order IDOrder StatusTaxesOrder AmountOrder Refund AmountCreated TimePaid Time
2Platform unique order ID.Current order status.Order total amount paid by the buyer.Order total refund amount of all returned SKUs.Order created time.Order paid time.
3576473553911582988Completed1.5212.0207/31/2023 6:14:07 PM07/31/2023 6:14:10 PM
4576473470461448948Completed1.2224.2207/31/2023 10:38:19 AM07/31/2023 10:38:22 AM
5576473470461448948Completed1.2224.2207/31/2023 10:38:19 AM07/31/2023 10:38:22 AM
6576473441536020829Completed0.514.4907/31/2023 8:11:24 AM07/31/2023 8:11:27 AM
7576473423026557177Completed1.0916.0907/31/2023 6:35:14 AM07/31/2023 6:35:17 AM
8576473308230422775Completed1.0516.0507/30/2023 6:26:15 PM07/30/2023 6:26:48 PM
9576473303896003495Completed0.615.607/30/2023 5:45:11 PM07/30/2023 5:45:35 PM
10576473291302408951Completed1.0911.5907/30/2023 4:47:56 PM07/30/2023 4:47:59 PM
11576473221986357846Completed1.1617.1507/30/2023 10:15:21 AM07/30/2023 10:15:24 AM
12576473223449055830Completed1.3820.3707/30/2023 10:13:48 AM07/30/2023 10:13:51 AM
13576473222655545942Completed1.5222.5107/30/2023 10:06:41 AM07/30/2023 10:06:44 AM
14576473201202336383Canceled1.4722.4616.0507/30/2023 8:23:02 AM
15576473198163628143Canceled1.6826.6716.0107/30/2023 8:18:43 AM07/30/2023 8:19:38 AM
16576473198163628143Canceled1.6826.674.2707/30/2023 8:18:43 AM07/30/2023 8:19:38 AM
107576472282577736405Completed1.4311.9307/26/2023 6:16:51 PM07/26/2023 6:16:54 PM
108576472272126316567Canceled2.6232.6216.3107/26/2023 5:36:22 PM
109576472272126316567Canceled2.6232.6216.3107/26/2023 5:36:22 PM
110576472273471377665Completed1.8114.0607/26/2023 5:31:15 PM07/26/2023 5:34:48 PM
Jul
Actually after looking at the data further... The formula could be simplified.
I still need to remove the duplicate IDs in column A, check column B for "canceled", and only count blank cells in column AA, but only need to sum the results in column X.
Or if it would be even simpler, we could probably only look at column AA for blank cells since the order was never paid for; therefore, it would automatically be canceled.
 
Upvote 0
Ok. Looking at it some more... I think it can be simplified.

What I think I need is something like this:

=LET(u,UNIQUE(FILTER($A$3:$A$1000,$A3:$A$1000<>"")),SUM(SUMIFS($D:$D,$A:$A,u,$B:$B,"<>canceled",$G:$G,"<>")/COUNTIFS($A:$A,u)))

But with the data set below the result isn't bringing up the correct answer.

The data below is already filtered to only show canceled orders in column B.

So the formula still needs to filter to only look at unique IDs in Column A. Then it needs to look at column B for "canceled" status and column G for a paid time (ignoring blank cells). Then from that result it needs sum column D and subtract column C.

2023 - TikTokShop Spreadsheet.xlsx
ABCDEFG
1Order IDOrder StatusTaxesOrder AmountOrder Refund AmountCreated TimePaid Time
13576473201202336383Canceled1.4722.4616.0507/30/2023 8:23:02 AM
14576473198163628143Canceled1.6826.6716.0107/30/2023 8:18:43 AM07/30/2023 8:19:38 AM
15576473198163628143Canceled1.6826.674.2707/30/2023 8:18:43 AM07/30/2023 8:19:38 AM
25576472910325125299Canceled0.6414.138.1407/29/2023 6:29:36 AM07/29/2023 6:29:39 AM
32576472737783583728Canceled1.2416.2416.2407/28/2023 1:08:22 PM07/28/2023 1:08:25 PM
49576472551669732200Canceled0.9414.438.0307/27/2023 7:16:38 PM07/27/2023 7:17:06 PM
59576472505876648245Canceled1.2914.788.2207/27/2023 3:32:28 PM07/27/2023 3:32:30 PM
63576472471512585154Canceled1.3416.348.1707/27/2023 12:18:33 PM07/27/2023 12:18:37 PM
64576472471512585154Canceled1.3416.348.1707/27/2023 12:18:33 PM07/27/2023 12:18:37 PM
73576472446468198625Canceled0.912.96.4507/27/2023 10:30:27 AM07/27/2023 10:31:19 AM
74576472446468198625Canceled0.912.96.4507/27/2023 10:30:27 AM07/27/2023 10:31:19 AM
107576472272126316567Canceled2.6232.6216.3107/26/2023 5:36:22 PM
108576472272126316567Canceled2.6232.6216.3107/26/2023 5:36:22 PM
118576472173537759938Canceled0.613.597.607/26/2023 8:23:05 AM
120576471947960291952Canceled1.1515.148.6607/25/2023 10:20:55 AM
132576471692102963229Canceled1.1711.6711.6707/24/2023 8:57:47 AM
134576471581935833731Canceled0.621.5915.607/23/2023 9:48:13 PM
138576471499699032822Canceled1.1214.117.7107/23/2023 1:09:33 PM07/23/2023 1:09:37 PM
139576471499572613674Canceled0.687.687.6807/23/2023 1:04:46 PM
145576471351433466840Canceled0.621.5915.607/22/2023 10:00:44 PM
151576471266098843704Canceled1.822.811.407/22/2023 1:26:16 PM07/22/2023 1:28:55 PM
152576471266098843704Canceled1.822.811.407/22/2023 1:26:16 PM07/22/2023 1:28:55 PM
161576471122029285411Canceled1.2411.7411.7407/21/2023 10:34:12 PM
171576470969234723697Canceled2.6623.6623.6607/21/2023 7:23:57 AM
172576470926672826818Canceled1.211.711.707/21/2023 5:50:24 AM07/21/2023 5:50:28 AM
192576470787577778407Canceled1.411.911.907/20/2023 12:18:09 PM07/20/2023 12:19:42 PM
208576470596244640010Canceled3.2441.7415.1807/19/2023 4:59:32 PM
209576470596244640010Canceled3.2441.7411.3807/19/2023 4:59:32 PM
210576470596244640010Canceled3.2441.7415.1807/19/2023 4:59:32 PM
215576470565671768656Canceled1.5412.0412.0407/19/2023 1:33:24 PM
240576470519023375309Canceled2.6422.6422.6407/19/2023 9:13:49 AM
249576470403564999594Canceled1.915.915.907/18/2023 7:41:16 PM07/18/2023 7:41:20 PM
281576469747735892351Canceled2.5223.5211.7607/14/2023 9:25:09 AM07/14/2023 9:25:44 AM
282576469747735892351Canceled2.5223.5211.7607/14/2023 9:25:09 AM07/14/2023 9:25:44 AM
286576469747448188941Canceled0.611.111.107/14/2023 9:06:47 AM
288576469747417125610Canceled1.3322.3215.9507/14/2023 9:03:34 AM
289576469744451490569Canceled1.827.313.6507/14/2023 7:58:30 AM
290576469744451490569Canceled1.827.313.6507/14/2023 7:58:30 AM
312576469733401334269Canceled0.9318.329.3307/14/2023 1:11:01 AM
315576469723151962577Canceled1.0511.5511.5507/13/2023 6:53:42 PM07/13/2023 6:54:23 PM
317576469710786171033Canceled1.1616.1616.1607/13/2023 1:35:30 PM
321576469698812678645Canceled1.1711.6711.6707/13/2023 8:46:10 AM07/13/2023 8:46:13 AM
323576469691430375745Canceled1.3625.3625.3607/13/2023 5:00:42 AM
354576469658358944424Canceled3.0224.0212.0107/12/2023 9:23:05 AM07/12/2023 9:23:31 AM
355576469658358944424Canceled3.0224.0212.0107/12/2023 9:23:05 AM07/12/2023 9:23:31 AM
Sheet1
 
Upvote 0
I have tried this to no avail, as well.

=LET(u,UNIQUE(FILTER($A$3:$A$1000,$A3:$A$1000<>"")),SUM(SUMIFS($D:$D,$A:$A,u,$B:$B,"<>canceled",$G:$G,"<>")-SUMIFS($C:$C,$A:$A,u,$B:$B,"<>canceled",$G:$G,"<>")))
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,139
Members
453,021
Latest member
Justyna P

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