how to count item from item name in excel worksheet - excel-formula

example how to count item from item name in excel worksheet
product name
1.micromaax mobil
2.nokia mobile
3.micromaax mobil
4.nokia mobile
5.micromaax mobil
6.nokia mobile How i count it in excel how much sold

You can use countif function for that.
See the image below for formula and usage
Reference : https://exceljet.net/excel-functions/excel-countif-function

Related

Excel rule to pull data from another page based on value from another cell

I have an old POS system which I can only export Barcodes and SKU's from in Excel format, and another export tool where I can Export SKU's and product details.
I am trying to combine those sheets together by adding some matching rules but the rules I am creating are not working, and I have tried so many I am not able to write them down what I have tried.
One sheet page name is BARCODE, the other one is PRODUCTS I want to add into Column A in the Products sheet the barcode from the BARCODE sheet, but both sheets contain the SKU and I need to match if the value B which is the SKU in both pages match before importing the BARCODE into column A in front of it.
BARCODE SHEET: A = Barcode = B = SKU
PRODUCTS SHEET A = Empty currently = B = SKU
If barcode match get BARCODE = A value and import it into PRODUCTS A if SKU matches.
Combine two excel sheets into one so I can use them for quicker import in eCommerce.

How does one count the number of occurances of a string on separate worksheets?

I have a workbook that contains multiple worksheets used for data entry and status monitoring for a project I am on at work. The "Overview" Worksheet contains multiple columns that have basic information [Number, Contact Info, Page Number, Issue, Comments, Status] (from columns A to F). The "Contact" Column contains a user's Name, Phone Number, Email, and Organization all in one cell.
Each Row is a unique entry but the Contact fields are reused based on if the same person has multiple inputs.
I have another Worksheet that is named "Contacts" that has the same information from the "Contact Info" Cells in the "Overview" worksheet, but divided into individual columns [Name, Phone Number, Email, Organization] (from columns A to D).
All of the code for the data entry is in a Userform that adds information to both worksheets, but specifically, the "Contacts" worksheet when a unique contact is submitted.
There are no duplicate rows in the "Contacts" worksheet.
Here's the problem:
I want to keep track of the number of occurrences of each contact in the "Overview" worksheet on the "Contacts" worksheet. That count will also be used to keep a unique enumeration per each contact on the "Overview" worksheet. (i.e. John Doe has 5 entries, so the "Number" Column on the
"Overview" worksheet will indicate "JD-1" "JD-2" … "JD-5" for each entry).
The intent is to have an aggregated list of all of the inputs but have a unique numbering methodology for each unique contact.
Any guidance will be greatly appreciated.
Problem I have encountered:
I would have used a CountIf type function in the cell but it gets out of my skill level going between worksheets.
Also, the way the Contacts worksheet is populated is to append unique entries on the next empty row, so if there are formulas in the Cells, it will not be viewed as a empty row.
This Workbook is used by multiple users and has to be functional from the beginning with a clean sheet.
Shouldn't need VBA for this, as you can do it with formulas...
You can use CountIf for the names, where one on the Contact sheet is a simple
B1 = CountIf(Overview!A:A,A1)
and the Overview sheet itself would be a self-counting sheet, where
B2 = CountIf(A$2:A2,A2)
That doesn't account for needing to split your string to include the initials "JD", but it may be more appropriate to just define those on your contact sheet and index/match the output, concatenating with your countif, similar to
B2 = Index(Contacts!C:C,Match(A2,Contacts!A:A,0))&"-"&CountIf(A$2:A2,A2)
Assumed Layout for Sheets("Contacts"):
ColA ColB ColC
Name Count Initials
John Doe 5 JD
Edit1:
Since the userform is inputting new lines (assumes you have found lr (last row) and will use that variable), you can adjust the formula to support input by VBA:
' to input formula as is to the sheet:
Cells(lr+1,2).value = "=Index(Contacts!C:C,Match(A" & lr+1 & ",Contacts!A:A))&"-"&CountIf(A$2:A" & lr+1 & ",A" & lr+1 & ")"
'tweak to have VBA do calc
With Sheets("Overview")
Cells(lr+1,2).value = Application.Index(Sheets("Contacts").Columns(3),Match(.Cells(lr+1,1).value,Sheets("Contacts").Columns(1)) & "-" & Application.CountIf(.Range(.Cells(2,1),.Cells(lr+1,1)),.Cells(lr+1,1).value)
End with
'I use cell references above, but you may want to swap .Cells(lr+1,1).value with the TextBox.Value from the userform
I dropped the "exact match" (0) from the match formula, so take that with a grain of salt, which may require more effort to make fit your exact model.
It may behoove you to have pre-determined Contact names for people to select from (think drop down) so that you don't have variance in the names that can/need to be found.

Find cell with same value in another worksheet, and sum it only if another cell has a value

I have a report that is generated in Sheets which contains an employee's name, but not his/her Transaction status. Not every employee will be on this worksheet on any given day.
In a 2nd worksheet I have a list of all employees' names,transaction and their status.
I want a formula in the first worksheet that looks for the same value (the employee name) on the 2nd workbook and then Sumsthe all the money under his\her name(Amount transfered) IF the transaction has been made of the cell 4 rows to the LEFT of that (transaction status) on the first workbook. Is there a way to do this? Thanks!
How about the SUMIF function:
https://support.google.com/docs/answer/3093583?hl=en
You could do something like this:
=if(A2="foo",sumif(Sheet2!$A$2:$A$5,B2,Sheet2!$B$2:$B$5))
where:
a2 = status for this client in the first sheet
sheet2!$a$2:$a$5 = list of all names in second sheet
b2 = name of this client in first sheet
sheet2:$b$2:$b$5 = corresponding transaction amount for each name in sheet2!$a$2:$a$5
Is this close to what you were looking for?

Button to Calculate COUNTIFS in Excel

I have the following data on the Sheet1 :
Then I've created a function to calculate each data based on specific criteria by using the COUNTIFS function on Sheet2, here is the function :
=COUNTIFS(Sheet1!E8:E400,"Cash",Sheet1!J8:J400,"ADISTYARA DEWINTHA",Sheet1!O8:O400,"Selling",Sheet1!M8:M400,"PRE SP NEW KARTU SMARTFREN 2015")
I want to count the number of data "SP PRE NEW CARD SMARTFREN 2015" by Adistyara Dewintha on Sheet1, then put it into a category Starter Pack on Sheet2
The above function works well and the results are as follows:
The question is, I want to create a button that when clicked the button will perform calculations on the COUNTIFS function SHEET 1 such that I created above and then the results will be inserted in the cell in Sheet2. If anyone can help, I would be very grateful and appreciative. Thanks.
"Because i've to calculate a large of amount data everyday, so if i write it manually, it's troublesome enough."
ok then why don't you do this
=COUNTIFS(Sheet1!E8:E400,A1,Sheet1!J8:J400,A2,Sheet1!O8:O400,A3,Sheet1!M8:M400,A4)
where
A1 = Cash
A2 =ADISTYARA DEWINTHA
A3 = Selling
A4 = PRE SP NEW KARTU SMARTFREN 2015
or whatever value you happen to want.
this way you don't have to redo the formula just the variables.

Copy data from rows in Worksheet to another worksheet based on quantity selected

I'm a Graphic Designer by trade and while I know basic Excel this is getting into foreign territory for me.
So I have been tasked with putting together our company's product price list (with +800+ products that are all broken into categories/tabs) into a version that users can select quantities per item and see a running list on the page of their total. No problem, I have this figured out.
Each item has a column for a part number, description, price, and quantity...with the quantity defaulted to zero. I need to get this so that if user wants an item they can change the quantity to whatever they want, and press the add/update purchase order button and have this values of that item's row add to a separate sheet. Additionally, if they were to change value to zero and press the button again, it would remove the item.
So right now each worksheet in the book is like this:
Ideally it would be great to just have one macro/button that once a user enters whatever quantity of item(s) they want, it would copy the row (but as column-order G B C F H) to a sheet in that book named "Purchase Order". If the user changes a quantity of an item to 0, and reclicks the button, it removes said row from the other worksheet. This would need to work through the 30+ other tabs, and append the rows below already entered values as the user continues to add products to their purchase order (starting on B22 on the Purchase Order worksheet)
My concerns are adding/deleting products in the future/other staff having to update this and not needing to do crazy changes to the macro if, say I need to add 5 more products to a tab.
I will take ANY help, insight, direction, or guidance anyone can shed on this issue. I greatly appreciate it!
Ok I don't know if I understood well your question, but here's what I'm thinking: You could create 2 buttons on the Worksheet, one with a big "+" on it, the other with a "-" and link them to 2 different subroutines. Those items could be positioned at the end or beginning of a product row. Right click on the buttons, go to properties and be sure that those are dependant on cell position and size. The "+" one could check if your "Purchase Order" is currently open (in case it isn't, could create a new one), and add all the content on the same row in the new worksheet (you can use Application.Caller to address the buttons and .Top / .Left to address its row/column). Naturally you'll want to search if the name of the product is already in the "Purchase Order", in that case increase quantity, otherwise copy all the row. Same thing with the "-" button eliminating the product row if quantity is 0. The fun part: you can create 2 buttons and the macros, and then copy the buttons for each row, since they each address rows on their right/left!
EDIT:
Sub Add()
Dim Button_cell_row As Integer
Dim ws As Worksheet, Target As Worksheet
Dim ProductName As String
Dim i As Integer
Set ws = ThisWorkbook.ActiveSheet
Set Target = Workbooks("Purchase_Order.xls").worksheets(1) ' Here you need to choose the file (Workbook) and the Worksheet (Tab) you want
Button_cell_row = ws.Shapes(Application.Caller).TopLeftCell.Row
Do Until IsEmpty(Target.Cells(i,4)) ' for example your product name is in the 4th column
If Target.Cells(i,4) = ProductName Then
Target.Cells(i,7) = cInt(Target.Cells(i,7)) + 1 ' say that the quantity is stored in the 7th cell
Exit Do
End If
i = i+1
Loop
If IsEmpty(Target.Cells(i,4)) Then ' meaning that the whole sheet has been searched but there's no product with a similar name on the whole "i" loop-range
' in this case "i" is now the index of your first empty row
ws.Range(Cells(Button_cell_row,3), Cells(Button_cell_row,8)).Copy _ ' For example you need to copy from 3rd column to 8th column...
Destination:=Target.Cells(i,1) ' ... on the first empty row, from column 1
End If
Set ws = Nothing
Set Target = Nothing
End Sub
This wasn't tested and may not work. But you get the idea :) For the "Remove" Sub, it is gonna be very similar.

Resources