I am working on a data trending worksheet that will have new data entered daily or weekly depending on the room. I am currently trying to get the average of the data in let's call it A(X), and I want to format the cell such that
IF value(A(X))>=value(B(X)) && value(A(X)) < value(C(X))
Fill Yellow
IF value(A(X))>=value(C(X))
Fill Red
Else
No Fill
Where B(X) contains a value that occasionally changes that warrants a warning (hence yellow) and C(X) contains a value that occasionally changes that warrants immediate action (hence red).
This data is being graphed as well. Everything I've tried limits me to only selecting a single comparison cell for the entire rule, which would make me have to hardcode every additional line. I've tried using OFFSET and haven't had any luck.
you may change the $A1>=$B1 to =if(AND($A$1>=$B$1,$A$1<=$C$1),1,0) in the formula for Yellow .. Then I think you're done. ( :
I have a list of prices for products that are variations (different size, color) of multiple parent product. Some products (for reasons not important to this question) have a price of zero.
I'm trying to write an excel formula that will return the lowest price for each parent product that is not zero
I've got this far:
=IF(SUMIFS(I:I,A:A,A3)=0,0,IF(AND(SUMIFS(I:I,A:A,A3)>0,MINIFS(I:I,A:A,A3)>0),MINIFS(I:I,A:A,A3),SMALL(IF(A:A=A3,I:I),2)))
Where I:I is the price column and A:A is the parent reference column
This works in all cases except where I have multiple variations of a parent product that have a zero value.
I need variables in a SMALL or MINIF function that will:
A. Only include the values for a single parent product in the calculation
B. Ignore any zeros in the calculation of the lowest value
Any help would be appreciated.
You can use a Pivot Table to easily create a dynamic list of minimums. Blank cells are ignored by default, and zero's (or any other number you want) can be excluded a few ways; I think the easiest would be using the Pivot Table's Filter feature.
They say a picture is worth a thousand words so an animated GIF must be worth a million... :)
More Information:
Office.com : Filter data in a PivotTable
Office.com : Display or hide zero values
tips.net : Excluding Zero Values from a PivotTable
You can use a 'traditional' PivotTable to do this. See ashleedawg's great answer.
You can also use a 'OLAP' PivotTable that's based off something called the Data Model to do it, that has a small advantage over the 'traditional' PivotTable in that you don't need to clear the PageFilter after refreshing. (More on this at the bottom of my answer).
Any Excel version from Excel 2013 later has the DataModel built in by default, and you also get access to the DataModel in 2010 if you install Microsoft's free PowerPivot add-in. Using the DataModel, here's what you need to do:
Turn your data into an Excel Table using the Ctrl + T keyboard shortcut:
Make a PivotTable out of it, but be sure to check the Add this data to the Data Model option:
Add Group to the Rows pane of the PivotTable, then right-click on Table1 in the fields pane and select Add Measure...:
Give the new Measure a name (I've called it Min Without Zero) and type =CALCULATE(MIN(Table1[Price]),Table1[Price]>0) in the Formula box then push OK:
Put a tick in the Min Without Zero checkbox in the PivotTable fields list.
Bing! The PivotTable shows the min (excluding zero) of each group by price.
Edit: I'd probably use ashleedawg's answer if I was doing this myself. But there's one caveat: If you add additional data in future and refresh, then you need to clear the filter and reapply the zero exclusion to be absolutely sure that any new numbers in the data are included. By way of a demonstration, if I filter out zero from a PageField, then I get just the result I expect:
...and here's how the filter looks:
But if I add new data and refresh, note that nothing has changed in the PivotTable:
...and if I look at the filter I can see why:
That's because when you deselect something from a filter, you're not actually saying "Give me everything except this thing" but rather "Give me the other things currently visible in this list, but leave any new things unselected."
Easily enough fixed: Just clear the filter and deselect zero again (or write some VBA code to do it automatically on refresh).
If the input data is sorted based on the parent reference level you can simply
use offset to find the required parent reference cells containing the price
Find the k-th smallest value using the SMALL formula (i.e. the smallest value)
Put a if condition to give you the 2nd smallest value if the smallest is 0
Place this in the 1st row
=IF(SMALL(OFFSET($I$1,MATCH(C1,$C:$C,0)-1,0,COUNTIF($C:$C,C1)),1)=0,SMALL(OFFSET($I$1,MATCH(C1,$C:$C,0)-1,0,COUNTIF($C:$C,C1)),2),SMALL(OFFSET($I$1,MATCH(C1,$C:$C,0)-1,0,COUNTIF($C:$C,C1)),1))
If you want a formula approach, you can use an IF statement to return a value if that value is over zero, and otherwise return FALSE, as functions like MIN conveniently ignore FALSE.
As per my other answer I recommend you turn the data into an Excel Table first with the Ctrl + T keyboard shortcut, as shown below. Then in a summary table you can use the following array-entered formula in E2:
=MIN(IF(Table1[Price]>0,IF(Table1[Group]=D2,Table1[Price])))
(Array-entered means you push Ctrl + SHIFT+ ENTER instead of pushing ENTER like you usually do)
And here's the result:
Iam new here so pls dont be mad if this is described problem:
In five cells I have list of five values. Then I have three another cells, which are combo cells. In each combo is possible to choose one of those five values.
I need to implement one another combo cell (also with those five values) with this functionality: When I change value in this new combo, all three combos above must change their values to this new value. After this, changing values in those three combos must be still possible.
How can I do this? Do I need macros or is there some easy way?
Thnx for help...
For the existing 3 'combo' cells you have, go to the Data Validation menu, select the Error Alert tab and uncheck the 'Show error alert...' option. Select OK.
This now allows you to enter any value in to that cell, and still have the drop down list menu.
Now you can go ahead and do something as simple as typing =F3 (or whatever the location of the new 'combo' cell), i.e. so that it will update with the value of the new selection, otherwise keep the value of the list choice. Example screenshot below...
I've imported a list of clients and their websites from the Google Analytics (GA) API in the following format:
Account Profile
Client 1 www.client1.com
Client 1 sub.client1.com
Client 1 tst.client1.com
Client 2 www.client2.com
Client 3 www.client3.com
Client 3 sub.client3.com
What I need is a dropdown list with the unique accounts names and then a second dropdown list with the dependent profiles of the chosen account. Something that looks like this:
Account Profile
Client 1 www.client1.com
sub.client1.com
tst.client1.com
We add accounts and profiles to GA all the time, so the list will need to be refreshed every time we run the report.
How would I go about doing this?
As long as you have this list sorted by Account, you can use a mixture of Offset CountA to give you all the ranges you need.
Steps would be:
a. Get unique values from Account column (i'm using VBA for this step but you could use Frequency formula to mash this too -- I'd avoid it if you can use VBA for this). Something along the lines:
Sub FindUniqueValues(SourceRange As Range, TargetCell As Range)
SourceRange.AdvancedFilter xlFilterCopy, , TargetCell, True
End Sub
(I've called this from my worksheet_change event for ease but if you are using vba to pull G.A. data, just integrate into that)
b. Feed this to Named Range (Say AccountsRange) that has the forumla =$D$2:INDEX($D$2:$D$5000,COUNTA($D$2:$D$5000)) -- This assumes you specified D1 as TargetCell for previous step and unique values won't be more than 4999 (1st value is row title in my case -- Hence starting from D2)
c. Add this Named Range AccountsRange as source for Data Validation List -- Your account combo box is done at this point. I'm going to assume you put this combo box in E2 and I'll build on this to derive the second ComboBox
d. Create a new Named Range say ProfilesRange with formula =INDEX($B$1:$B$5000,MATCH($E$2,$A$1:$A$5000,0),1):INDEX($B$1:$B$5000,COUNTIF($A$1:$A$5000,$E$2)+MATCH($E$2,$A$1:$A$5000,0)-1,1)
Note: if you copy paste from here the above formula will contain a line-break invisible character after COUNTIF($A and excel will complain about invalid formula, just retype $A$1 part of COUNTIF and it should be fine
A2 is the start of Account column of G.A. imported data (A1 being the title and assuming maximum of 4999 data rows here) E2 is the Comboboxed cell from previous AccountsRange dropdown step. -1 in Match step is needed as the offset needs to be 0 for first value row and not 1 which will be returned from Match. Second 1 is column offset (it can be more if you need to hop several columns to get secondary data). CountIf is pretty self explanatory :) This basically gets us the number of cells we need in final range from the starting point.
e. Create your new Data Validation List that uses ProfilesRange as its source and your secondary combo box is done.
Issues that may arise:
When you change Accounts Combobox, Profiles combobox will probably error out as the values in profiles are unlikely to be present in new client. You could either ignore the error (it will fix itself once you select correct value from newly refreshed dropdown or throw a bit more of VBA fairy dust in there to clear the drop down cell when the value changes in E2.
Data Validation List compalains about evaluating to an error when you try to setup ProfilesRange. It is safe to ignore this error and continue. It basically means nothing computable was returned by ProfilesRange (most probably because you haven't selected anything in AccountsRange that actually computes to a ProfilesRange -- of course assuming your actual cell ranges for formulae used here are actually correct for your sheet)
Thanks to osknows for his tip and improvement on forumlae (in comments below): Avoid use of OFFSET its very slow over large ranges and is volatile. =OFFSET($D$2,0,0,COUNTA($D$2:$D$5000) can be replaced with =$D$2:INDEX($D$2:$D$5000,COUNTA($D$2:$D$5000)) for the named range. (this tip has been incorporated into this solution now, so you won't see the original Offset forumlae unless you check version history)
My problem: I have two ranges R16 and R01. These ranges were set up by swiping each range and then renaming them in the upper left panel of the sheet. Each range requires users to fill in each cell with a value. R16 requires users to enter a number of 0 through 5. The range R01 requires a value of 0 or 1 to be entered. NO cell can be left blank in any cell within these two ranges. These ranges and requirements are specific to this sheet only. It would be nice if at the time of user entering a number, an error message appeared like [invalid entry] if the value inputted was outside parameters set. For example, in R16, if someone entered 12 or -1 they would be alerted. Finally when the user presses a button on the page to use these values in a separate process, it is essential to check that no cell is left blank. I am trying to find a way to halt the running of the marco (via the button) if these parameters above are not met. Thank you
You don't need programming for the first part, this is a built-in feature in Excel called "Validation". The second part of your question, the pressing of the button, requires a macro that checks both cells.