New table values are not included in excel calculations - excel

I have created a table in excel which contains information on licenses, and I have created a formula which adds the value of licenses purchased in the last 30 days. The following code seems to do the trick:
=SUMIF(LicenseList[Purchase date], ">="&(today()-30), LicenseList[EURvalue])
My only problem is, that when I add new data into my table, it is not included in the result!
This is just one calculation which doesn't work - it seems that all of the calculations which are referencing the particular table, are not getting updated (I have naturally tested that the added values indeed do become part of the table).
Crossing my fingers for some help! :)

Try the Ribbon menu item Formulas > Formula Auditing > Evaluate Formula. This allows you to see the result of each step in the formula. You can also check precedents and dependents.

Because the data was being populated into the table by a VBA script, the format was invisibly not a date. This was required for the column to be included in the formula, and even though excel told me that the whole column was set as dates, they clearly were not. By converting the values to dates using CDate() before inputting them to the table, the formula now works.

Related

Excel Macro to perform a formula where one column has the same value in several rows

I can't quite find the right code example to do what I'm looking to do.
We have an excel file with data from a project where a request can have several TASKs associated with it and different teams or organizations can be assigned. I'm trying to create a summary of whether the request was worked on by one team or another or "jointly" worked on (based on more than one team/org being assigned to tasks under the same request).
Here is the example and the result I'm looking for:
I want the code to be able to loop thru all rows checking where column A (request #) is the same value and builds an array of the value contained in column B (Team assigned) for each row where A has the same value. Then some sort of function to determine if the values in the array contain more than 1 team. If all of the TASKs were worked on by one team, just that team is the result, if more than one team worked on TASKs, the it results with "Joint".
This can be done without VBA, using formulas.
For the Result column in my screenshot, column E, I used
=IF(COUNTIFS([request],[#request],[team],[#team])=COUNTIFS([request],[#request]),[#team],"Joint")
The same formula without structure references reads like this:
=IF(COUNTIFS($B$3:$B$22,B3,$c$3:$c$22,c3)=COUNTIFS($B$3:$B$22,B3),E3,"Joint")
Apply the formula to the whole table column. If you don't want to use structured references, make sure to use absolute references for the column ranges, i.e. $B$3:$B$22 etc.
The Pivot table has Request and Result in the row areas, and the Tasks in the Values area. A pivot table needs to be refreshed when new data is added.
A dynamic result table can be achieved with the new dynamic array formulas available in Office 365 versions of Excel.
In H12 and I12 of my screenshot I use
=UNIQUE(Table1[request])
=XLOOKUP(H12#,Table1[request],Table1[Result])
The formula automatically spills down as far as required.
So, no VBA required, which means you can save as a regular .xlsx file, which will also run perfectly fine in the browser and on mobile devices.

How to count unique column data in an excel sheet

I am using excel sheet and i have data column as shown below:
As we can see that some of the names are duplicate or appeared twice. My question is how can count unique name records or rows associated with each name for summary column.
Out put i am looking for is shown below:
Not sure which formula to use as count is counting all of that data i.e. '7' in this case. How can i use count or any other function to count unique records as shown above?
You can do what you're after with a pivot table.
Click the Insert tab then select "Recommended Pivot Tables".
A window will open up prompting you to select the data range. I recommend using a named range for your list and referencing that, but you can just highlight the list directly if you want.
Once the data range is selected, click "Ok" and new window will open with exactly what you want. A unique values list and a "Count of Column1". It is the default of the recommended pivot tables.
I outlined this because it's easy and fast, but it's important to understand you can make this pivot table yourself from scratch if you learn about pivot tables in general. Pivot tables are often overlooked in Excel as an option.
Lastly, you could get really advanced with Excel Power Queries. Just Google "Excel Power query" and you will be shown all kinds of information on them. They are a close second place in power to manipulate Excel data short of using VBA.
Good luck!
CountA(Unique(D2:D8,,False)) = 5 [Count(Unique(D2:D8)) is the same as False is the default.]
CountA(Unique(D2:D8,,True)) = 3 (once and only once)
Note: the Unique function was released in late 2019 to Office 365. So if you want to use this check your version, not present in 1908, present in 2006.
Edit: It's actually in 2002, I just updated my 1908 machine.
HTH
If names duplicates are removed the following formula can be used: =COUNTIF(B:B,F2)
If duplicates must be removed by formula, MATCH (searches for a specified item in a range of cells, and then returns the relative position of that item in the range.) and SMALL (Returns the k-th smallest value in a data set.) functions can be used as shown.
C$1048576 is used to reference last row number for a big list case.
formulas:
Column A, names sequence
Colunm B, names
Column C, formula =MATCH(B2,B:B,0)
Column D, formula =IF(COUNTIF(C2:$C$1048576,C2)=1,C2,"")
Column E, formula =SMALL(D:D,A2)
Column F, formula =VLOOKUP(E2,A:B,2,0)
Column G, formula =COUNTIF(B:B,F2)
For anyone like me without O265's lovely Unique & Filter Functions, and who doesnt want to use a pivot table, and there are many ways to do this, but this i have just done this in normal excel.
List of data in Column H, Formula in column O3. Drag down. Highlights your distinct and unique values from H.
=IF(COUNTIF(H:H,H28)=1,"U - "&COUNTIF(H:H,H28),IF(COUNTIF(H$1:H27,H28)=1,"U - "&COUNTIF(H:H,H28),"-"))
Formula is short. You can just do this and drag down. Apply the same principal to your worksheet data wherever it is.
=IF(COUNTIF(H:H,H3)=1,"U",IF(COUNTIF(H$1:H2,H3)=1,"U","-"))
Similarly, you can just use this formula here (credit goes to this source for this one):
=(COUNTIF($H$1:$H1,$H1)=1)+0
Id like to point out that the above formula is a better formula than mine. It highlights with a "1" (or with a tweak, the value of your choice) the first time any value is seen/spotted on any given list, whether duplicate or unique.
Whereas mine is a bit "more random" when picking up the "unique and distict" values.
Mine gets there in the end, but Extend Office's gets there first, as I think is proper (getting the first time a unqique distict value is spotted/occurs.).
Formula in K5 =IF((COUNTIF($H$5:$H5,$H5)=1)+0=1,"UNIQUE DIST","") and drag down...
You could append/add a normal basic countif after the results to show how many actual times the given value appears if you wanted. :
=IF((COUNTIF($H$5:$H5,$H5)=1)+0=1,"UNIQUE DIST","")&" - "&COUNTIF(H:H,H5)

Excel 2010 Conditional Formatting will not use an INDEX/MATCH formula

I have a table that uses the following formula to pull data from two other tables:
=IF(INDEX(InitASIPTable,MATCH([#[EFH JST]],InitInspJST,0),MATCH(HeaderRow,TailNumberRow,0))="INITIAL CW",INDEX(SortieTime[CW-13R],MATCH(HeaderRow,SortieTime[Tail],0)),INDEX(InitASIPTable,MATCH([#[EFH JST]],InitInspJST,0),MATCH(HeaderRow,TailNumberRow,0)))
Basically, it looks at the first table to see if an initial inspection has been completed. If yes, it goes to the second table to pull the recurring inspection remainder time, if no it provides the remainder until the initial inspection. The issue I'm having is getting the conditional formatting in Excel 2010 to highlight the cells in the table to show me if the time I'm seeing is being pulled from the initial table or the recurring table. I have 12 rows x 15 columns within this table that I'm trying to lay this formatting on.
I've tried using this formula for the conditional formatting:
=ISNUMBER(INDEX(InitASIPTable,MATCH([#[EFH JST]],InitInspJST,0),MATCH(HeaderRow,TailNumberRow,0)))
However, Excel rejects that formula with a "The name that you entered is not valid" error message, even though when I drop that formula in the middle of the table it correctly returns "TRUE" or "FALSE."
I've also tried explicitly defining every range and while Excel accepts the rule, it doesn't apply the conditional formatting. Here's the modified formula that Excel is accepting:
=ISNUMBER(INDEX('SHEET 1'!$G$5:$U$16,MATCH($A$2:$A$13,'SHEET 1'!$A$5:$A$16,0),MATCH($D$1:$R$1,'SHEET 1'!$G$2:$U$2,0)))
Defining the ranges here:
Sheet 1 G5:U16 is the initial time data table
A2:A13 is the [EFH JST] column (the unique key) in the table to be formatted
Sheet 1 A5:A16 is the initial table's JST column
D1:R1 is the header row for the table to be formatted
Sheet 1 G2:U2 is the header row for the initial data table
Any time I drop that formula into the middle of the table it correctly returns true or false, so I know the formula works here. Am I trying to process a formula more complicated than Excel can handle here or am I missing something else?
You can't use table references in the conditional formatting formula ie. [#[EFH JST]]
You can try saving the formula to a named range and then using that
After asking this same question over the the MSDN Technet Forums, the answer that finally fixed the issue was to set the conditional formatting to be =SUMPRODUCT((InitASIPTable=D2)*1)>0. It's not a solid fix as it depends on both tables never having identical values, but it does work.

Use VLOOKUP but detach the value from the lookup once it is in the cell/looked up

I have the following:
1 Access file with a big list of items that people can order.
1 Excel file with 2 tabs.
In the 2nd tab of the Excel file I import the Access table.
For each row I have a dropdown list in the first column with the values of the first column of the access table.
In the 2nd column of the first tab I use VLOOKUP to show the price linked to the item of the first column.
In the 3rd column of the first tab the user can fill in an amount.
Here's the catch:
in the 4th column of the first Excel Tab I want to show a total so B * C. Nothing hard about that. But I want this value to NEVER CHANGE.
So even if the Access database is updated I do not want the value of the already calculated cells of column 4 to change.
I know it seems pretty unlogical but I really need this.
Any suggestions? Is there a formula that I am missing?
EDIT from post:
The file is to be used be other people than myself. If paste special can be done automatically as in like a formula it would help but that doens't exist or I haven't found it.
Thanks in advance.
If the formula is linked to a connection (e.g. OLAP cube, a table that is linked to an Access table) then remove the connection before sending the sheet out. See link.
If you distribute the workbooks to people who do not have access to the data itself (not on your network) the issue will solve itself, take away that some dummies will complain about their data disappearing not refreshing.
The formula you're asking for would refer to itself once it has a value, confer circular reference.
If used by your close enivronment you might want to have a VBA snipplet insert your formula and then do the PasteSpecial method automatically (you'll have to enable macros on each of the computers involved in this case).

Formula to reference data from a PivotTable

I am having some difficulty writing a specific Excel formula. I have a summary sheet that pulls data from various other sheets extracted from a database. One of these is a PivotTable whereby using the Item Number in the first column and the dates along the top row as a reference I can pinpoint the data I need. eg:
To address the highlighted cell I would normally manually write:
=GETPIVOTDATA(HighPiv,"SPN010977-204 11333")
HighPiv is the name I gave to the pivot table as I am referring to it from my summary sheet.
This works, however the Week numbers along the top will continuously be changing in the pivot every month and therefore this formula will not pick up the values accurately once the pivot is updated. I have been looking into a way to make the referencing more dynamic. This is the summary where the data is required:
Rather than within the quotation marks of the formula (adding the specific Item number and Week number word for word), I was hoping to refer to the cell references of the summary sheet. (So if I wanted Item number, say A55, and Week number, say H50). The dates in the summary sheet change according to the pivot so referring to the dates on the summaries to get the data would be a better way for it to be kept up-to-date.
The problem here is I don't know how to go about it. I have tired to refer to the cells in question but it doesn't seem to work giving me #REF! or #VALUE! errors.
I think what you would like is:
=GETPIVOTDATA("Qty",HighPiv,"Item",A55,"Week",H50)
I find the easiest way to write such a formula is to start by ensuring that Pivot Table Tools > Options > PivotTable – Options, Generate GetPivotData is checked then in the desired cell enter = and select the required entry from the PT (here63). That would show (for example) “SPN010977-204” and 11333 or ”11333” but these can be changed to A55 and H50.

Resources