I have a column of dates in Excel, and there will always be only two dates in the column. I want a formula to return the date that exists most (so if 1/23/13 occurs 24 times and 1/24/13 occurs 72 times, I want the formula to return 1/24/13).
I used the MODE formula across the range, and this worked for a couple days in a row, but today it did not work. Upon further review, I realized the dates are really viewed by Excel as decimal numbers, and I imagine this is the problem.
I could get to what I need by inserting a new column and filling it with =TRUNC(cell) for all cells in the range, and then applying the MODE formula to the new column, but I'm hoping there might be a way to do it without introducing a new column or formulas. Is it possible to do something like =MODE(TRUNC(range))? That specific formula didn't work, but I'm hoping something similar will.
Yes, your suggested formula should work......but it's an "array formula" which means that you need to enter it with a specific key combination.
Paste the formula in the cell then press F2 key to select formula and then hold down CTRL + SHIFT keys and press ENTER. If done correctly that will place curly braces like { and } around the formula in the formula bar.
If you have any blanks in the range then the result may be skewed with
=MODE(TRUNC(range))
so you can change that to
=MODE(IF(range<>"",TRUNC(range)))
Related
Got this formula:
{=IF(A4=MIN((C4=$C$4:$C$46711)*(B4=$B$4:$B$46711)*($A$4:$A$46711)),"First Event","All")}
I'm using the same one for MAX, and it works just fine. But when changing to MIN it fails, and I suppose it's because of value 0 and/or blank cells in my range. I've tried to add "ISNUMBER" after the "IF" but it doesn't do the trick...
How can this formua be modified to return lowest value, not counting 0 and/or blank cells in Column A?
If you have this function, you can use something like the below in place of your MIN function:
=MINIFS(A1:A10,A1:A10,"<>0")
If not, something like:
=MIN(IF(A1:A10<>0,A1:A10,""))
Depending on your version of Excel, you may need to "confirm" this array-formula it by holding down ctrl + shift while hitting enter. If you do this correctly, Excel will place braces {...} around the formula as observed in the formula bar.
Substituting in your formula would look like:
=IF(A4=MIN(IF(((C4=$C$4:$C$46711)*(B4=$B$4:$B$46711)*$A$4:$A$46711)<>0,(C4=$C$4:$C$46711)*(B4=$B$4:$B$46711)*$A$4:$A$46711,"")),"First Event","All")
I test your formula for a smaller range, there can be a smaller issue, which is causing trouble to you.
In your range $A$4:$A$46711 of the formula there can be a number or entry which is "text" formatted
I have done the following three trials:
Trial 1. Try it with blanks
Trial 2. Try it with blanks and zeros too.
Result: In both the cases your formula, is working fine
Trial 3: with Text in column A, It is generating an error
Hence I am concluding to check your A column range for any text formatting
Remember you can also use Aggregate for these since Excel 2010:
=AGGREGATE(15,6,A1:A10/((A1:A10>0)*(B1:B10="a")),1)
I have to put together a weekly reporting system in Excel. I need to report on the month to dale sales results and the completed week (Fri-Thu). This is collected from multiple sales agents in sales documents stored in Sharepoint.
For this, I've used "SUMIFS" to collect the data, the following way:
=SUMIFS('SHAREPOINTREF/FILE.xlsm'!SalesResults[One off],'SHAREPOINTREF/FILE.xlsm'!SalesResults[Date],">="&B7,'SHAREPOINTREF/FILE.xlsm'!SalesResults[Date],"<="&C7)
(B7 is a cell reference which determines the start date of the week, with C7 being the end of the week)
The trouble with SUMIFS, as well as SUMIF, COUNTBLANK, COUNTIF and COUNTIFS, is that they don't work when the sourcing document is closed. Microsoft has a workaround here: https://support.microsoft.com/kb/260415?wa=wsignin1.0
I can't seem to figure out how to adapt the workaround methodology recommended to apply not just to a simple IF statement, but to multiples. I assume I would need to use an "AND" statement, but I keep getting errors when I'm trying.
I have about half a dozen different calculations to make, but I am pretty confident if I can solve this one, the others should start to gel a bit better.
Try this:
=SUM(IF('SHAREPOINTREF/FILE.xlsm'!SalesResults[Date]>=B7,IF('SHAREPOINTREF/FILE.xlsm'!SalesResults[Date]<=C7,'SHAREPOINTREF/FILE.xlsm'!SalesResults[One off])))
Entered using Ctrl+Shift+Enter.
Non-Array formula equivalent:
=SUMPRODUCT(--('SHAREPOINTREF/FILE.xlsm'!SalesResults[Date]>=B7),--('SHAREPOINTREF/FILE.xlsm'!SalesResults[Date]<=C7),'SHAREPOINTREF/FILE.xlsm'!SalesResults[One off])
But both seems to return #REF! when source WB is closed even though the link provided in the question claims otherwise.
Edit1:
After more digging, above will work but you need to use a Normal Range and not a Table Range.
The only problem is, you loose the advantage of Table's Dynamic Data Range.
So something like this will work even if the source is closed:
=SUMPRODUCT(--('SHAREPOINTREF/[FILE.xlsm]Sheet1'!$A$2:$A$11>=B7),--('SHAREPOINTREF/[FILE.xlsm]Sheet1'!$A$2:$A$11<=C7),'SHAREPOINTREF/[FILE.xlsm]Sheet1'!$B$2:$B$11)
The recommended solution is to use array formulas. Those are a special type of formula that, when typed, must be activated by pressing Ctrl + Shift + Enter in the formula bar. Such a function works by applying a function that would normally accept a single cell (such as IF() ) to a range. You will need to wrap the result in an aggregating formula such as SUM() or COUNT(). Here's an example:
=SUM(IF($A$1:$A$10="Apple", $B$1:$B$10, 0))
This formula would check each cell from A1 to A10 and compare it to "Apple", if it is true it will return the corresponding row from $B$1:$B$10. The result would be an array of values of column B where column A is "Apples" with zeros where it is not. The surrounding SUM() aggregates the array and gives the equivalent of SUMIF().
As I mentioned, you would need to enter Ctrl + Shift + Enter after typing the formula for it to work as an array formula. Otherwise, it will work as a regular formula.
I want to use the Index formula to list data in my excel sheet.
I want to list the data of the column A that contains "finished" in the corresponding cells in column E.
Currently I'm using the following formula:
=INDEX(IMs!A:A;MATCH("finished";IMs!E:E;0))
The problem is, only the first value appears. I want to list ALL of them.
Is it possible with the vlookup formula?
Thank you very much in advance.
Kind regards,
Vanessa
First enter this formula in B1:
=COUNTIF(IMs!$E:$E,"Finished")
Then enter this array formula** in your first cell of choice:
=IF(ROWS($1:1)>$B$1,"",INDEX(IMs!$A$1:$A$1000,SMALL(IF(IMs!$E$1:$E$1000="finished",ROW(IMs!$E$1:$E$1000)-MIN(ROW(IMs!$E$1:$E$1000))+1),ROWS($1:1))))
Copy this formula down (though not the one in C1) until you start to get blanks for the results.
If the upper row reference that I chose (1000) is not sufficiently high, then change it as required. Note, however, that since this is an array formula, it is not recommended that you make this upper bound too high (and certainly don't reference entire columns!), since this will have a significantly detrimental effect on spreadsheet performance.
From your post, it also appears that you are using a version of Excel in which the argument separator in formulas is not the comma but the semi-colon. If this is indeed the case then you will need to make the necessary amendments to the formulas I provided.
Regards
**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
I'm using excel 2010.
I need a formula that will return the highest value of a mixed variable.
Look up VFL will return VFL00151
A1 VFL00001
A2 VWS00004
A3 VSC00056
A4 VFL00151
A5 VCC10025
A6 VGH00122
I'm avoiding using macros.
Thanks
With Col_A referring to your range in column A, and the lookup value (VFL) in C1, the following array formula (entered by holding down ctrl-shift while hitting enter, the following formula will perform as you request:
=IF(MAX(N(ISNUMBER(SEARCH(C1,Col_A))))=0,"",INDEX(Col_A,MATCH(MAX(IF(ISNUMBER(SEARCH(C1,Col_A)),--MID(Col_A,4,99),0)),IF(ISNUMBER(SEARCH(C1,Col_A)),--MID(Col_A,4,99),0),0)))
Of course, this assumes all of your entries start with three letters, and then are followed by digits.
Also, using the same set-up and assumptions as Ron Rosenfeld, but also assuming you're using Excel 2007 or later, array formula**:
=IF(COUNTIF(Col_A,C1&"*")=0,"",INDEX(Col_A,MATCH(1,(LEFT(Col_A,3)=C1)*(0+MID(Col_A,4,99)=MAX(IFERROR(0+SUBSTITUTE(Col_A,C1,""),0))),0)))
Note also that this solution is case-sensitive whereas Ron Rosenfeld's is not.
Regards
**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
=MAX(--MID(A1:A6,4,LEN(A1:A6)-3))
ctrl+shitf+enter when you've entered the formula, to create an array formula. This assumes that all of your numbers have the same form, of 3 letters, then your number.
The mid formula takes the numeric part, based on the pattern you've outlined above. If the pattern is not consistent, you've got less hope with a formula. Doing this as an array, does all of the cells in the range in one step, and returns an array of numbers. This can then be 'maxed'
Update. To take this a step further, and do a lookup on the same principle (without error handling):
=INDEX(A1:A6,MATCH(MAX(--MID(A1:A6,4,LEN(A1:A6)-3)),--MID(A1:A6,4,LEN(A1:A6)-3),0))
I have a table of my workdays and I want to count instances of word 'work' in each row.
I have a table like this:
I used this code in J1 cell but it doesn't work.
=SUM(IF(2:2 = "Sleep",1,0))
I have found this formula in microsoft's website but it doesn't work.
What is causing this problem?
You need to use the COUNTIF function.
=COUNTIF(C2:I2,"Sleep")
This goes in Cell J2
From Excel's Help
The COUNTIF function counts the number of cells within a range that meet a single criterion that you specify. For example, you can count all the cells that start with a certain letter, or you can count all the cells that contain a number that is larger or smaller than a number you specify.
When in doubt, press the magic button F1 in Excel. :)
Just came across a similar thing in a worksheet and came to google before I remembered why it didn't work.
The countif statement above is perfectly fine, however the original formula given wouldn't have worked as to use a sum in this way means you have to make it an array or CSE Formula instead.
So, if you come across this, click in the formula bar and press ctrl + shift + enter and it should sort the whole thing out.