We have thousands of rows of data in the following format
| Name | Born On |
|:-----------|------------:|
| Tom | Jul 15 |
| Harry | Jul 15 |
| Katy | Oct 2 |
| Britney | Oct 2 |
| Miranda | Oct 2 |
| Victoria | Oct 2 |
| John | Sep 30 |
| Warren | Sep 30 |
| George | Sep 30 |
I would like to add a serial number based on the "Born On" column as follows
| Name | Born On | Serial Number
|:-----------|------------:|--------------:|
| Tom | Jul 15 | 1
| Harry | Jul 15 | 2
| Katy | Oct 2 | 1
| Britney | Oct 2 | 2
| Miranda | Oct 2 | 3
| Victoria | Oct 2 | 4
| John | Sep 30 | 1
| Warren | Sep 30 | 2
| George | Sep 30 | 3
The "serial number" needs to be grouped by "born on" date.
Please help. Thanks.
If the serial numbers start in cell C2 and the Born on cells start in B2, then use this formula in cell C2 and copy down:
=COUNTIF(B$2:B2,B2)
Related
I'm trying to find the week of the year of particular dates using a formula in Excel. I found that Excel is considering the Sunday as the 1st day of the week instead of Monday as the first day.
I used the formula =WEEKNUM(A2) (where A2 is the date row) and got the result as below
--------------------------------
| Date | Week of Year |
--------------------------------
| 5/16/2015 | 20 |
| 5/17/2015 | 21 |
| 5/18/2015 | 21 |
| 5/19/2015 | 21 |
| 5/20/2015 | 21 |
| 5/21/2015 | 21 |
| 5/22/2015 | 21 |
| 5/23/2015 | 21 |
| 5/24/2015 | 22 |
| 5/25/2015 | 22 |
--------------------------------
But how do I get the result as below (Considering Monday as the first day of the week)
--------------------------------
| Date | Week of Year |
--------------------------------
| 5/16/2015 | 20 |
| 5/17/2015 | 20 |
| 5/18/2015 | 21 |
| 5/19/2015 | 21 |
| 5/20/2015 | 21 |
| 5/21/2015 | 21 |
| 5/22/2015 | 21 |
| 5/23/2015 | 21 |
| 5/24/2015 | 21 |
| 5/25/2015 | 22 |
--------------------------------
Pass a second argument to WEEKNUM: 2 stands for Monday.
=WEEKNUM(A2, 2)
I have a supermarket shopping dataset with two columns: Id, Products.
Id is the unique ID of the customer, Products contain the items he has shopped for.
Table looks like this:
| S.No | ID | Products |
|----- |-------------|--------------------|
| 1 | 23 | 4,5,6 |
| 2 | 21 | 21,11 |
| 3 | 21 | 11,21,23,18,17 |
| 4 | 125 | 21,22 |
| 5 | 23 | 4,5,8 |
Now i want to identify who is the most shopped customer of each of the product like this
| Product | highestshopper |
| 4 | 23 |
| 11 | 21 |
| 21 | 21 |
Using get_dummies with sum before idxmax
df.set_index('ID').Products.str.get_dummies(',').sum(level=0).idxmax()
Out[145]:
11 21
17 21
18 21
21 21
22 125
23 21
4 23
5 23
6 23
8 23
dtype: int64
I have this set of data in Excel:
Date | Year | Spend | Budget | Product
Jan | 2017 | 300 | 350 | Pencils
Feb | 2017 | 450 | 450 | Pencils
March | 2017 | 510 | 520 | Pencils
... | ... | ... |
Dec | 2017 | 234 | 240 | Pencils
Jan | 2018 | 222 | 222 | Pencils
Feb | 2018 | 458 | 500 | Pencils
March | 2018 | 345 | 400 | Pencils
... | ... | ... |
Dec | 2018 | 600 | 600 | Pencils
I'm trying to build a pivot table that shows:
RT stands for "running total"
Av stands for "available"
Year | 2017
| Jan | RT | Av | Feb | RT | Av | March | RT | Av
Pencils| 300 | 300| 50 | 450 | 750| 50| 510 |1260| 60
In brief, "available" = running total + budget for remaining months. Any ideas?
Thanks!
If I understand correctly:
available = sum(budget) - sum(spent)
running total = sum(spent)
You should add a column for running total, that will sum the spent column from the beginning up to current row.
And add a column for available, that will sum the budget column from the beginning up to current row, and will reduce the value of the "running total" column (of the same row) from it.
I have the following data set:
+--------+---------+----------+
| Date | Revenue | Expected |
+--------+---------+----------+
| Dez 5 | 51 | 1 |
| Dez 4 | 72 | 1 |
| Dez 3 | 72 | 1 |
| Dez 2 | 59 | 1 |
| Dez 1 | 81 | 1 |
| Nov 30 | 50 | 1 |
| Nov 29 | 53 | 1 |
| Nov 28 | 99 | 0 |
| Nov 27 | 85 | 0 |
| Nov 26 | 65 | 0 |
| Nov 25 | 94 | 0 |
+--------+---------+----------+
The column Expected determines whether or not the Revenue number has been confirmed. Now, I want to have a pivot table that sums up the revenues per month. The final result should be this:
+-------+-------------------+-----+
| Month | | |
+-------+-------------------+-----+
| Nov | Revenues | 446 |
| | Expected Revenues | 103 |
| Dez | Revenues | 335 |
| | Expected Revenues | 335 |
+-------+-------------------+-----+
I can't seem to get this working for the month November, because my calculated field looks like this:
=IF(Expected*1>0;Revenues*1;0)
I had to add *1 because it wouldn't work for some numbers, so you can mentally ignore this for the moment.
In any case, the result of this is the following:
+-------+-------------------+-----+
| Month | | |
+-------+-------------------+-----+
| Nov | Revenues | 446 |
| | Expected Revenues | 446 |
| Dez | Revenues | 335 |
| | Expected Revenues | 335 |
+-------+-------------------+-----+
Can anyone point me in the right direction here? I understand that the reason for this is most likely that the Expected column gets summed up first and then the IF comparison comes about. Is there a way to circumvent this?
I have two sheets in excel, Summary and Data. The data sheet is connecting through SQL Server and Summary sheet is summarising the data in a table.
Summary sheet
+------+--------------+
| ID | Month - Year |
+------+--------------+
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
+------+--------------+
Note: I am using a formula to get the distinct IDs from the data sheet. ID column is column A, Month - Year column is column B. ID 1 is in A2 square.
Data sheet
+------+--------------+
| ID | Month - Year |
+------+--------------+
| 1 | Oct 2014 |
| 2 | Dec 2014 |
| 3 | Oct 2016 |
| 4 | Jan 2016 |
| 5 | Nov 2015 |
| 6 | Jul 2015 |
| 7 | Jan 2016 |
| 8 | Nov 2015 |
| 7 | Jan 2016 |
| 8 | Nov 2015 |
+------+--------------+
Note: ID 1 is in A2 square, Month - Year is in B2 square.
How do I write a formula for the Summary Month - Year column to get each month - year (from data sheet) based on the ID column (in the summary sheet)?
Expected Result:
+------+--------------+
| ID | Month - Year |
+------+--------------+
| 1 | Oct 2014 |
| 2 | Dec 2014 |
| 3 | Oct 2016 |
| 4 | Jan 2016 |
| 5 | Nov 2015 |
| 6 | Jul 2015 |
| 7 | Jan 2016 |
| 8 | Nov 2015 |
+------+--------------+
Equivalent Expected Result in Pivot Table (with rows Month-Year and ID):
-Nov 2015
--5
--8
-Jan 2016
--4
--7
-Jul 2015
--6
-Oct 2014
--1
-Dec 2014
--2
-Oct 2016
--3
Effort:
=VLOOKUP(A2,Data!$A$2:$A$500,2,FALSE)
=VLOOKUP(A2,Data!$A$2:$B$500,2,FALSE)
The formula you tried needs to include both the columns in the table array variable.
Additionally the array must contain the lookup value in the first column of the table array.
I prefer however to use the INDEX MATCH combination, it removes the constraint of the search column being the most right column of the table array. Using the values you gave for your ranges it would be:
=INDEX(Data!$B$2:$B$500,MATCH(A2,Data!$A$2:$A$500,0))
For more information about VLOOKUP you can get info at:
https://support.office.com/en-us/article/VLOOKUP-function-0bbc8083-26fe-4963-8ab8-93a18ad188a1