Excel - fill in cell basd on cells enters on worksheet but only fill - excel

I have an excel sheet that has a sheet that our sales team have to fill in. There are 31 rows and column d may have the same text in multiple lines.
I need then to take all the text from column d and have it automatically sum the total from each text in d.
Column d is a dropdown list.
I don't want it to automatically go line from line, for example,
the data entered is:
9/12/15 ABC Store $10.00
9/13/15 DEF Store $15.00
9/14/15 ABC Store $5.00
9/16/15 DEF Store $50.00
I need it to automatically, as they enter the data to do the following on a different sheet.
A1= ABC Store B1= $15.00
A2= DEF Store B2= $65.00
etc. The data they choose as the enter may vary per month so I need it to understand to pick what is entered and then combine those totals if that text is choose between rows 5:31.
I really appreciate anyone's help.

Try to use the =SUMIF()-formula. See example below.

Related

How to generate invoice numbers with a combination of customer codes without duplicates and sequentially with VBA

Dear All Master,
How to generate invoice numbers with a combination of customer codes without duplicates and sequentially with VBA.
so the position in "C2" is the customer code.
So the "serial" will change continuously in order with the customer code. Does it need invoice numbers stored in their own sheets so that they make it easier for duplicates and sequential to occur? if necessary how?. Please recommend the best solution
in "C4" is the combination invoice number.
JS : COMPANY NAME
12 : MONTH
22 : 2 DIGIT YEAR
XX : CUSTOMER CODE
001 : SERIAL
EXAMPLE
JS-12-22-10-001
JS-12-22-10-002
JS-12-22-11-001
JS-12-22-11-002
Sub generatenumberinvoice()
Sheet1.Range("c3").Value = Sheet1.Range("c3").Value + 1
End Sub
This is not directly help you, but maybe you can have a look and modify it according to your case.
Make a new workbook
Rename Sheet1 into TABLE, Sheet2 into DATA, Sheet3 into FormInput
Type on each sheet exactly like in the picture below. For the time being, ignore the INPUT button which seen in the image of sheet FormInput
In the Name Manager, create a named range CustID which refers to:=OFFSET(TABLE!$A$1,0,0,COUNTA(TABLE!$A:$A),2)
Create another named range : data which refers to: =OFFSET(DATA!$A$1,0,0,COUNTA(DATA!$A:$A),4)
Create another named range : trans which refers to : =OFFSET(FormInput!$A$6,0,0,COUNTA(FormInput!$A:$A)-4,1)
Finally, copy the formula below and paste it to cell B3 of sheet FormInput =IF(COUNTIF(INDEX(data,,3),"*JS-"&TEXT($B$1,"yy-mm-")&VLOOKUP($B$2,CustID,2,FALSE)&"*")<>0,"JS-"&TEXT($B$1,"yy-mm-")&VLOOKUP($B$2,CustID,2,FALSE)&"-"&TEXT(AGGREGATE(14,6,RIGHT(INDEX(data,,3),3)/(LEFT(INDEX(data,,3),12)="JS-"&TEXT($B$1,"yy-mm-")&VLOOKUP($B$2,CustID,2,FALSE)&"-"),1)+1,"000"),"JS-"&TEXT($B$1,"yy-mm-")&VLOOKUP($B$2,CustID,2,FALSE)&"-001")
Try to type aaa (the name of customer) in cell B2 sheet FormInput. If everything above done correctly, cell B3 will show JS-22-12-10-001. Type bbb then it show JS-22-12-11-001, type ccc then it show JS-22-12-12-001. The last 3 characters always show 001 (which means this is the first invoice number of Dec-22 for whatever id), because there is no data in sheet DATA. Hence it just show 22-12 depends on the date seen in cell B1, and -10 or -11 or -12 depends on the name of the customer seen in cell B2.
Try to change the date to something like 21-nov-22. Cell B3 will show 22-11 and the CustID depends on the name seen in cell B2, and the number always show "001". Play around by changing the date of different month and change the name (aaa or bbb or ccc) so you understand thoroughly how it works.
Now, fill data in sheets DATA exactly like the image below
Back in FormInput, fill the date with Nov-22 month and fill the cust name with aaa, cell B3 will show the next invoice number: JS-22-11-10-006 because the formula read the data that the last number for id 10 in Nov-22 is JS-22-11-10-005, so the formula add 1 to the serial number in cell B3 for id 10 (customer aaa in this case).
Still in November date, type bbb for cust name. It will show JS-22-11-11-001 in cell B3 because there is no data for id 11 of Nov-22. So this is the first invoice number of Nov-22 for id 11 (customer bbb in this case).
Now change the date to December date, then type aaa for cust name. Cell B3 will show the next invoice number for id 10 in Dec-22 is JS-22-12-10-002, because the formula see that the last number in the data for id 10 of Dec-22 is "001".
Still in December date,
type ccc for cust name. Cell B3 will show JS-22-12-12-004.
type bbb for cust name. Cell B3 will show JS-22-12-11-001 which means this is the first invoice number for id 11 in Dec-22.
Play around by filling a different invoice number in sheet DATA then fill the date and the name of the cust in sheet InputForm.
The INPUT button seen in InputForm is a vba code to input the data seen in InputForm into sheet DATA. But this is another case, and if you want to know it, I think you'd better open another question.
Thank you.
Thanks to Mr. Peter_SSs, because I get the formula for cell B3 from him in this link

Fill in table based a column of categories in Excel

I have a table that looks like this:
Type Value
Movie 5
Food 3
Gas 10
Food 2
.... ....
And There's a second table I want to fill in with "Value" based on their type in the first table, so that the corresponding rows look like this:
Rent Food Movie Gas Clothing ... ( appear in specific order bc they are subcategories)
5
3
10
2
The title row is already there, so I was thinking there might be some kind of lookup method to do this? How do I do that?
your second table apperas to hold one value per row but it doesn't have a label. it does correlate to the original row number, is this by design or coincidence?
if this is by design then you can use those 2 columns, hide them if you like, get a unique list of categories by copying you r abels to a new colum, removing duplicates in the data tab, then paste special transpose in c1 to create colum headers.
so column a and b remain unchanged
row 1 contains header starting at column c
your data starts at c2
this is the formula
=Iferror(vlookup(C$1,$A2:$B2,2,false),"")
drag it down and to the right
you can copy paste special values when done to remove the formulas
for something with only a hundred or thousand cells this will be one of the easier options but i would not do this on large tables, for those i would use power query or VBA
Assuming your 1st table is in Sheet1 and 2nd table is in sheet2.. you may try to fill in Sheet2!A2
=IF(Sheet1!$A2=A$1,Sheet1!$B2,"")
and drag it all the way.. Hope you get how it works.. and what you need.

Excel look up value in array, return next value

I would like to look up a value in a range and return the value in the next row, but can't quite figure out how to do this. I especially would like to do this with formulas rather than VBA, and preferably with built-in formulas than custom (VBA) formulas, due to macro security issues.
I'm using Excel 2010. My workbook has two worksheets, "assessment" and "lookup". In lookup, I have lookup tables.
"lookup" looks something like:
Column A Column B Column C
1 Sales Engineering Manufacturing
2 Alice Bobbie Charlie
3 Dawn Edgar Frank
4 George Holly Isabel
In "assessment," I have some some drop downs from which users select one name from each column in "lookup." Based on some other criteria, I then rank these and create a new, sorted list (using INDEX() and MATCH()) that produce the selected name and corresponding column name a new sort order
Column A Column B
10 Engineering Edgar
11 Sales Alice
What I'd like is to return the name from the next row.
Column C
10 Holly
11 Dawn
But I'm having real trouble figuring out how to get there.
Assuming lookups is located at B2:D5 (change as required) and the result data is at F2:H3 (change as required) enter this formula in cell H2 then copy down.
=INDEX(
INDEX($B$2:$D$5,0,MATCH($F2,$B$2:$D$2,0)),
1+MATCH($G2,
INDEX($B$2:$D$5,0,MATCH($F2,$B$2:$D$2,0)),0))

Automatically working out the average of filtered results

I have a spreadsheet where column P has a score between 1-6
The cell O4 has the following formula: =AVERAGEIFS(P8:P5000,P8:P5000,"<>6",P8:P5000,"<>0")
This formula searches for the average of the score in column P excluding 6, blanks and 0
Column O has staff names e.g John, Mark, Tim.......
What i want to do is for Cell O4 to automatically calculate the average of the figures shown in column P after i have used the filter function to show only results of a selected staff member.
I was hoping excel might be able to do this automatically however cell O4 appears to still be showing the average of the whole column P regardless of whether i have filtered or not.
I was given the formula below on another forum but it seems to be giving slightly wrong results albeit only by a small amount but i need to have the results exact if possible. Any help appreciated.
=SUMPRODUCT(1-ISNUMBER(MATCH(P8:P100,{0,6},0)),SUBTOTAL(9,OFFSET(P8,ROW(P8:P100)-ROW(P8),0,1)))/SUMPRODUCT(1-ISNUMBER(MATCH(P8:P100,{0,6},0)),SUBTOTAL(2,OFFSET(P8,ROW(P8:P100)-ROW(P8),0,1)))
Maybe
{=AVERAGE(IF((P8:P5000<>6)*(P8:P5000<>0)*SUBTOTAL(103,INDIRECT("O"&ROW(8:5000))),P8:P5000))}
will do what you want. Assuming the Filter is on column O.
The 103 in SUBTOTAL will also exclude if rows are manually hidden. If this ist unwanted and it should only exclude hidden rows, if filtered, then use 3 instead.
This is an array formula. Input it into the cell without the curly brackets and then press [Ctrl]+[Shift]+[Enter] to create the array formula.
I would create a separate table in a new sheet with all unique staff members and then perform the calculation. This way, you can quickly compare values for all staff just by scanning the table instead of having to constantly update the filter to see the values for potentially dozens or hundreds of staff. You would add the staff name range and criteria to your AVERAGEIFS formula.
For your example:
Sheet 2
A B
--- ---
1 | Staff Average
2 | Bob =AVERAGEIFS(Sheet1!$P$8:$P$5000,Sheet1!$O$8:$O$5000,A2,Sheet1!$P$8:$P$5000,"<>6",Sheet1!$P$8:$P$5000,"<>0")
3 | Mary =AVERAGEIFS(Sheet1!$P$8:$P$5000,Sheet1!$O$8:$O$5000,A3,Sheet1!$P$8:$P$5000,"<>6",Sheet1!$P$8:$P$5000,"<>0")
4 | Joe =AVERAGEIFS(Sheet1!$P$8:$P$5000,Sheet1!$O$8:$O$5000,A4,Sheet1!$P$8:$P$5000,"<>6",Sheet1!$P$8:$P$5000,"<>0")

Formula to Get data for a specific date

Date Time Country Desc
16/04/14 8.30 am India abcd
16/04/14 9.30 am India pqrs
17/04/14 9.30 am India xyz
17/04/14 10.30 am India abcd
I wish to get all the data of 16/04/14 in another sheet using formula. Vlookup takes only the first row data as reference is 16/04/14. Is there any other way to get data.
Try this then:
Assuming you have this data in Sheet1:
And you want to get all matches of dates in Sheet2 like this:
What you need to do is use this formula:
=IFERROR(INDEX(Sheet1!A$1:A$5,SMALL((IF(Sheet1!$A$1:$A$5=$E$1,ROW(Sheet1!A$1:A$5))),ROW($A1)),1),"")
Above is an Array Formula entered by pressing Ctrl+Shift+Enter.
Enter it in A2 then copy on the remaining cells.
For our example, I copied it until Row 10 (A2:D10).
Then you just need to type in the value you want displayed in E1 as shown in the picture.
Then all the columns will populate with the data that you need.
Hope this helps.
Important: The ranges in the formula needs to be adjusted to suit your needs.

Resources