Excel adding unwanted cells to formula - excel

I've been using Excel for quite a long time & I've never noticed this issue before. Someone at work asked me & I thought it must be a simple fix, but I'm stumped.
Let's start with A1:F1 being blanks, and G1 being =SUM(A1:C1) Pretty standard add the values. I only want G1 to sum the first 3 cells in Row1, even though there will be values in the others.
When I add values into cells A1:C1, no problem. As soon as I add a value to D1 the formula in G1 auto magically "fixes" itself to =SUM(A1:D1). Then a value in E1 changes the formula to =SUM(A1:E1). And so on... I need the formula to only sum A1:C1 regardles of the other values.
So I spent the usual 15-20 minutes looking all over the ribbons and options, and another 15-20 on the interwebs, but here I am. Hope it's not something stoopid that I missed and I feel like a dummy.

Winner Winner Chicken Dinner.
pnut solves it. "Uncheck Extend data range formats and formulas."
File> Options> Advanced > Uncheck Extend data range formats and formulas
Thank you.

I'm not sure if there is a way to do that, but you could just put =SUM(A1+B1+C1) in G1 instead and then it won't do that

Related

How this Formula Works?

I'm looking at a legacy spreadsheet and I cannot for the life of me figure out how this formula works. I'm by no means an excel wizard.
The spreadsheet tracks billing for a company for members of staff. On each row, the user puts an ID, the amount, and formula then puts the figure under a column for a given staff member.
And the formula:
=IF(A2="Foo",A2="Foo")*(SUM(B2))
I would have done this:
=IF(A2="Foo", B2, 0)
Which appears to have the same effect.
Any insight?
=IF(A2="Foo",A2="Foo") is equivalent to =A2="Foo". It results in a boolean value, which is used by the multiplication operation as 1 or 0.
I don't see any reason to express it that way instead of the more concise and intuitive formula that you offer.
The original formula has a lot of excess calculations going on in it. It can be simplified as you mentioned, which is what most people would do. Some alternate forms might be:
=(A2="Foo")*B2
The above formula you would place in D2 and copy down and then you would have to redo the String comparisson for column E then again for F. If you used the following formula you could place it in D2 and copy it down and to the right as needed without having to adjust the formula.
=($A2=D$1)*$B2
In more common terms it would look like
=IF($A2=D$1,$B2,0)

Trying to put together a packaging list from a spreadsheet in excel

Excel Example 1
In column A I have a list of order numbers. In columns B-F I have the different products and the number of orders each have placed for the product. How do I make it so that when I type in the order value into I1, it will return all cells with values into the cells below?
I believe it is an array that i need but not positive. This is just an example, I am trying to do this on a larger scale.
Try to use this formula, it should help or at least give you an idea.
=INDEX($B$2:$F$6,MATCH($I$1,$A$2:$A$6,0),MATCH($I2,$B$1:$F$1,0))
OK, it will be like this:
In I2 your formula is
=INDEX($A$1:$F$1,1,MATCH(TRUE,ISNUMBER(INDIRECT("A"&MATCH(I1,A:A,0)&":F"&MATCH(I1,A:A,0))),0))
In I3 your formula is
=INDEX($A$1:$F$1,1,MATCH(TRUE,ISNUMBER(INDIRECT("A"&MATCH(I1,A:A,0)&":F"&MATCH(I1,A:A,0)))*(A1:F1<>I2),0))
In I4 your formula should be
=INDEX($A$1:$F$1,1,MATCH(TRUE,ISNUMBER(INDIRECT("A"&MATCH(I1,A:A,0)&":F"&MATCH(I1,A:A,0)))*(A1:F1<>I2)*(A1:F1<>I3),0))
And there it goes...
For each cell below you will need to repeat the multiplication "(A1:F1<>Ix)" with every cell above, because it evaluates an array which will compare to the others and return the next true result that isn't any of the colors above neither is a color without value.
Every of those formulas are array formula (confirm them with ctrl+shift+enter). You probably know how to get the values in J, but just in case, it's:
=INDEX($A$1:$F$7,MATCH($I$1,A:A,0),MATCH($I2,$A$1:$F$1,0))
PS: my Excel is in portuguese so my arguments separator is ";", I did change them for "," here in this comment. Just in case the formula doesn't work for you, try to look for some ";" I may have missed, also pay some attention to the $$ because I didn't lock the I1 reference properly, still I hope this can help you.
Thanks everyone for your answers. I ended up going with a vlookup then set a quick macro to run auto-filtering based off conditional formatting. It was the cleanest way i could find to work with the large amount of data I had.

Excel automagically insert formula

I came across this excel files (xlsx) so there is no VBA involved, no table, no name. But columns C is updated with formula "automagically" when I insert a number into column B. I checked the name manager, there is no name. I would like to know how can I achieve this kind of functionality. Have anyone come across something like this?
P.S: When I copy Range A2:C13 and paste to a different files. The magic still works!
Screenshot in Excel 2016
So, you go to File>Options>Advanced and tick the box that says:
Extend data range formats and formul̲as
Ok, I got this one. Simply add 4 or 5 subsequence row with formula in column B and C. And continue continue to enter data in column B like this GIF:
I manage to have this behavior by having the formula defined on all the cells of the column* with an "IF(NOT(ISBLANK(c); <your formula>; "")" condition on the input cell:
e.g. you enter this in C1
=IF(NOT(ISBLANK(B1)); B1/(1+B1);"")
you click and drag the formula like you know how;
Et voila
*)(or as many as necessary, since it could be a little "heavy" for Excel to have the formula 1048576 times, nearly for nothing)
Hope it helps

Conditional Formatting rows with shared Merged Cell

I've got a little helper spreadsheet that I use, and there are some Merged Cells.
Rather than get rid of these, which I know can cause headaches, I was looking for an idea on fixing an issue.
I have a few rows that share a merged cell. When this merged cell is not empty, I want the rows to highlight. Currently, the formula (applied over A1:B4) is =$B1<>"" and then a fill. Works okay for the first row, but not the other three:
I was thinking I could add some more logic, but there's nothing really there for me. It's a pretty simple table. Unfortunately, there's not really a way to say (for rows 2:4), if row 1 is colored, then color this row...(Although I think I've seen clever uses of Named Ranges to do something like that, but I could be mistaken).
So, in A2, what's the conditional format formula "thinking"? Is it going to =$B2<>"", in which case ...what's it looking for as B2? If I select A2, and look at the conditional format rule applied to the current selection, it still shows =$B1<>"".
Thanks for any ideas/tips. It's not a huge deal, so I don't need a VBA solution - just maybe an idea or trick for using CF with merged cells.
Edit: For a more full explanation - the idea is that col. B will have an invoice number and if it's there, make the row a color. I will be repeating this "chart" a bunch, and have some non-grouped companies, who have their own lines. I just don't like the gap of color there in my group and was trying to get it to have a color when the first of the group does.
I usually try to base my CFR's on formulas.
    
After selecting all of column A and B I created a CF rule with the following.
=AND(LEN($A1), ISNUMBER(MATCH(1E+99, $B$1:$B1)))
The approximate MATCH function simply looks for the last number in the B column. I can see a missing invoice number in a cell like B7 would generate confusion but perhaps you can expand on this for conditions not demonstrated by your examples.
If you want to use "placeholder" instead of blank cells (when there is no invoice), you could try the following formula:
=(LOOKUP(2,1/($B$1:$B1<>""),$B$1:$B1)<>"x")*LEN(A1)
With sample data it looks like this:
When the cell is left blank (no placeholder), column A is highlighted, column B is not.

Changing cell reference for a SUMIF criterion?

I'm trying to tell Excel to change the cell reference for a SUMIF formula based on the last cell that contains a value in each row. Right now, I know I could write a nested if statement to do this for me, but it's far too unwieldy to be a long-term solution.
Example:
On a separate report, every person in this list has multiple lines recording their daily sales. On a small scale, I'd simply write a SUMIF that uses for A2, B3 and C4 as criteria. The scale is much much larger, so my current solution is to write out a logic check with the SUMIF formula folded into it.
In this case, the formula in E2 would be:
=IF(C2="",if(B2="",SUMIF('range',A2,'range'),sumif('range',B2,'range')),sumif('range',C2,'range'))
Is there a different way to tell Excel to run the SUMIF with the last value found in each row?
I was hoping I could use COUNTA for each row, then have the SUMIF formula use the COUNTA value to change the criterion cell reference. I'm missing something here.
=SUMIF('range',INDEX(A2:C2,MATCH("zzzzz",A2:C2)),'range')
seems worth a try.
Edit Too long for a comment:
I don’t really have any idea how =MATCH() works but think of it as traversing left to right while searching. When it fails to find a match it just happens to have been looking at the last entry and (conveniently!) offers that up. So the key is to look for something that won't be found.
For people’s names I chose “zzzzz” as unlikely to be present. For numbers anything up to 9.99999999999999E+307 is theoretically possible and hence some people use that (eg an hour ago Formula to get the first cell with a numerical value from a selection?) but I prefer a googol (1E+100) and that seems quite large enough, is much shorter – and easier to remember, even if a few 9s more or less would make no difference, nor likely what couple of integers are after the +.

Resources