How to match cell value and get other value

Island Gryl

New Member
Joined
Jan 11, 2011
Messages
22
Office Version
  1. 365
Platform
  1. Windows
Hi:

I have some excel basic excel abilities and have a need to go beyond them and not sure what the right approach is so am looking for guidance.

I have two worksheets that each have one common data field, "Order Name" (which is actually the Order number).

Sheet 1 Sales: is data based on a date range and includes all Order Names's for the period (potentially more than one occurrence if multiple items ordered, usually shipping) and the $ value of that Order Name, along with the tax on that order # if any.
Sheet 2 Taxes: is the same date range and includes the same Order Names and a Tax Label Field. Not every order has tax so those with no tax do not exist on this sheet.

My goal is to add the Tax Label Field from Sheet 1 to Sheet 2 and where the Order Number from Sheet 1 does not exist on sheet to Put Exempt.
This lets me report the correct amounts of Sales Revenue per Tax Type and remit the correct amounts of tax to the appropriate authorities ;)

Is this a task for SUMIF or vlookup or ??

thank you in advance, much appreciate the help of the greater mind

Janice
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough (we do not need many records) data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary. Use XL2BB to upload the sample data.

Remember to desensitize the data.
 
Upvote 0
Sheet 1
sales_2019-01-01_2019-05-06.csv
ACDEFGHIJKL
1order_nameordersgross_salesdiscountsreturnsnet_salesshippingtaxestotal_salesnet_quantityExempt Sales
2#1002000000000
3#1002139.99-39.99000001
4#1003000000000
5#1003142.99-4.29038.70038.71Exempt
6#1004142.99-8.6034.3901.7236.111
7#1004139.99-8031.9901.633.591
8#1004139.99-7.9903201.633.61
9#1004139.99-8031.9901.633.591
10#1005000000000
11#1005139.99-7.9903203.8435.841
12#1006000000000
13#1006137.990037.9904.5642.551
14#1006137.990037.9904.5642.551
15#1006137.990037.9904.5642.551
16#1007135.99-3.59032.403.8936.291
17#100700000100100
18#1008139.990039.9904.844.791
19#1008137.990037.9904.5642.551
20#1008000000000
21#1009137.990037.9904.5642.551
22#100900000100100
23#1010137.990037.9904.5642.551
24#1010000000000
25#1010179.980079.9809.689.582
26#1011185.98-10.37075.6109.0884.692
27#1011139.99-4.82035.1704.2239.391
28#1011139.99-4.81035.1804.2239.41
29#1012000007070Exempt
30#1012137003700371Exempt
sales_2019-01-01_2019-05-06


Sheet 2
taxes_2019-01-01_2019-05-06.csv
BDEG
1order_nametax_nametax_ratetaxes
2#1002PST0.070
3#1002GST0.050
4#1004GST0.051.72
5#1004GST0.051.6
6#1004GST0.051.6
7#1004GST0.051.6
8#1005GST0.051.6
9#1005PST0.072.24
10#1006GST0.051.9
11#1006PST0.072.66
12#1006GST0.051.9
13#1006PST0.072.66
14#1006GST0.051.9
15#1006PST0.072.66
16#1007GST0.051.62
17#1007PST0.072.27
18#1008GST0.051.9
19#1008GST0.052
20#1008PST0.072.66
21#1008PST0.072.8
22#1009GST0.051.9
23#1009PST0.072.66
24#1010PST0.075.6
25#1010GST0.051.9
26#1010PST0.072.66
27#1010GST0.054
28#1011GST0.051.76
29#1011PST0.072.46
30#1011GST0.053.78
31#1011PST0.075.3
32#1011PST0.072.46
33#1011GST0.051.76
taxes_2019-01-01_2019-05-06



What I want to do is identify all the tax exempt sales and label them as such.
Sheet 1 has all order numbers (called order name) 1002 - 1012 for the example
Sheet 2 has the order number column but only the orders with Tax charged, exist here.
So my though is to compare sheet 1 to sheet 2 order numbers and when the order number doesn't exist on sheet 2, and the Total Sales is not zero, put Exempt

Once I have that I think I can generate the Sales & Tax figures I need from more simple SumIf's
The only "mock Up" I have done here is to write Exempt in the three fields that meet the criteria for this Order Batch.


Hopefully I did this correctly.
Thank you again for your guidance.
 
Upvote 0
I can't believe I have asked this stupid question and now can't delete it, embarrassed.

I was looking for a lot more complicated solution to this and now see the zero tax on the same sheet gives me the same answer as comparing the two.
Please ignore this request
 
Upvote 0
Hi &welcome to MrExcel
How about
=IF(AND(J2>0,COUNTIFS('taxes_2019-01-01_2019-05-06'!A:A,A2)=0),"Exempt","")
 
Upvote 0
Solution
Looking at this some more, the requested solution is actually better as just using the Zero Tax field picks up returns and non-taxable shipping. It is just perhaps not necessary :eek:,
Thank you for your suggestion, I will try it this weekend, have to go to the day job now!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
HI There,
I was able to recreate the formula, monkey see monkey do ;)
But it starts to give me Exempt at row 6, 7 & 8 etc. which is wrong.

I entered the formula and drew it down the page allowing it to renumber as it went so if this section COUNTIFS('Taxes '!A:A,A2)=0),"Exempt","") looks at the order number (Taxes & Sales) this won't work because the orders with no tax don't exist on sheet, Taxes. #1003 for example.

This is how the whole formula for line 6 is on my sheet
=IF(AND(J6>0,COUNTIFS('Taxes '!A:A,A6)=0),"Exempt","")
It is returning Exempt when it's has tax

This is the data in Sales Line 6

#1004
1​
42.99​
-8.6​
0​
34.39​
0​
1.72​
36.11​
1​
Exempt



This is the date for Taxes Line 6, it is the same order only because order #1004 has multiple lines, it could easily be a different order number

2019-03-01​
#1004GST
0.05​
Canada
1.6​


Since Order Number 1003 doesn't exist on the Taxes sheet and order numbers take a random number of lines, this approach not doable I think?

New approach
I'm thinking a simpler approach, =Sumif (Column G ( which does not include shipping) and test for zero in the Taxes Column I
This can all be done within the one sheet.

=SUMIF(I2:I184,"=0",G2:G184)

Got this to work, but now as a last fine tune, would like to add another filter for eliminating any order with "Shipping" in Column B.
the full description is "Shipping Fee" hopefully that is not an issue, but as of now I am looking to Sum column G if Column I is = 0 and column B does not contain "Shipping".

Janice
 
Upvote 0
Got it!

=SUMIFS(G2:G184, I2:I184,"=0", B2:B184,"<>Shipping Fee")

Took all day, but I learned a lot :)
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,525
Members
448,969
Latest member
mirek8991

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