SUMIFS with multiple criterion including a single cell - google-sheets

I'm organizing a buddy's sports betting spreadsheet and am trying to get my SUMIFS formula to work.
On the Data Ref sheet, I'm trying to sum a cell based on three different criteria. Player, Bet Type, and Live/Pre Match.
Here is the formula I have come up with.
Player - Bautista-Agut,
Bet Type - Parlay,
Live/Pre - Pre Match
When I use this formula it works perfectly.
=sumifs(Main!H$3:H,Main!D$3:D,"*Bautista-Agut*",Main!$E$3:$E,$D35,Main!$C$3:$C,$E35)
However, I don't want to have to go back through each of the 260 cells and change the name of each player with "**". I want to simply reference the cell in column c.
When I try to reference a cell with the player's name in it the formula doesn't work. I think this is because on the main spreadsheet some cells in the column I'm referencing has more than one player in it and the cell is only looking for the one player name.
Is there another way to perform these SUMIFS by referencing a cell? I've tried REGEXMATCH(), INDEX(), MATCH() nested within the SUMIFS but still couldn't get them to work.
You can view my spreadsheet here.
Thanks for taking the time to read my question. Also, if there are any tips on how I've structured my data I'd love to hear them. I'm brand new to these types of formulas.

I don't want to have to go back through each of the 260 cells and change the name of each player with "**". I want to simply reference the cell in column c.
You can replace the name with "*"&C2&"*":
Instead of:
=sumifs(Main!H$3:H,Main!D$3:D,"*Albot*",Main!$E$3:$E,$D2,Main!$C$3:$C,$E2)
Use:
=sumifs(Main!H$3:H,Main!D$3:D,"*"&C2&"*",Main!$E$3:$E,$D2,Main!$C$3:$C,$E2)

Related

Conditional Formatting on Google Sheets with Named Ranges

I've searched a bit for this issue and maybe I can get help here.
I'm trying to apply a conditional formatting through a named range and I only figured out that "Indirect" plays an huge role on this.
This is the typical table I'm working on, Heading, plus every row has a name with some notes. The table has a named range (Let's call it "Table") assigned to A1:D7 because I have some scripts on GAS that sort the list in different ways based on button pressing.
Since the table is updated pretty often, I just add rows to the "Table" Named range, so the script works fine.
Under the table the typical conditional formatting I use to color the zero or negative cells of both the column B and C but not the column D
Now what I have to do is to apply the whole conditional formatting on only the named range (but just the columns B and C).
I could "Apply to the range" B:C (So I don't have to change it) but under the table there are some other numeric data that I don't want to format.
Using a custom formula =INDIRECT("Table")<=0
doesn't work either since the table has the column Name, plus with some arrangements it colors both the cells B* and C* if the B value is negative and the C is not.
I'll probably add some more stuff since I'm working on it but if someone could aid just on this it would be very helpful
Browsing a bit and understanding that the Conditional formatting just cycle every cell in the range applied and uses the custom formula to check if it should format it or not, I should put it the fact that the cell has to be inside the named range as a condition.
I found this to be useful on a "B2:C" range =AND(NOT(ISERROR(INDEX(INDIRECT("Table"),ROW(B2),COLUMN(B2)))),*condition1_on_B2*,*condition2_on_B2*,*etc*)
(found it on the second post here on this link)
The first conditions returns true when the cell is not inside the named range
NOT to reverse the ISERROR value
ISERROR will return true if INDEX throws an error which is only when the cell is outside the named range
INDEX will attempt to find the cell B2 (or the cell the conditional formatting is checking on every iteration) inside the named range.
It probably is very heavy, performance-wise but for now it works, if there is something else, I'll wait for a better answer.

Using the RIGHT function on a FORMULA within a cell?

I'm reformatting a sheet so I can utilise the data for some graphs. The existing formatting is a bit clunky to "transpose" to the required format, so I'm trying to figure out an easier way.
"Graphs" tab should transpose specific data from the "Statistics" tab - as can be seen. I'm trying to avoid creating manual cell references for the "Decks" column and instead extract the Col reference from the formula, increment it by 3, thus creating the next cell reference.
My attempt can be seen in A9.
I've tried googling how I can reference formula in a cell on a RIGHT function, but the keyword is giving a tonne of results that don't address my issue.
Here's the sheet!
https://docs.google.com/spreadsheets/d/1VKUhiwRGFMJOtDbLc0pqpckHFV7oNB2bjTqs2WqTqbo/edit?usp=sharing
=TRANSPOSE(FILTER(Statistics!H1:1, Statistics!H1:1<>""))

How to reference a cell in other sheet which contains a referenced cell not locked to this sheet?

I've searched for hours and couldn't find an answer to the following problem:
I have two sheets, Blue and Red.
I want Blue!A1 to be "exactly" like Red!A1 but I find this problem:
Red!A1 contains "B1+B2", both are Red's cells.
However, when I write Blue!A1 like this: "=Red!A1", the return value is something like "=Red!B1 + Red!B2", and not the "=CurrentSheet!B1 + CurrentSheet!B2"
My problem is that I cannot reference the Blue sheet in the Red one because I want dozens of sheets referencing Red in the same way, so when I change A1 in Red I change all the other sheets' A1 accordingly with their respectives B1s and B2s, not Red's B1 and B2.
I want to have a cell in a sheet which can be referenced by any other cell in any other sheet exactly like it was in the first place.
For instance, if I have a cell which contains =B1+B2 in a sheet, I want to reference it in another sheet in a way that the new =B1+B2 references the current sheet's B1 and B2 cells instead of the former one's.
Can someone help me to solve this problem?
Thank you in advance
Alexandre Trajano
Solution 1
Copy & Paste.
In Google Sheets, copy & paste iterates the formula automatically. If you change sheet, it will change the referenced cells to point to the current sheet; if you change location within the same sheet, it will shift the cell references according to how many columns and rows you shifted.
In contrast, cut & paste will move the formula without iterating the cell references.
Solution 2
If you have a truly large number of sheets you want to create based on a template and don't want to c&p a thousand times, you can use Apps Script.
In particular, you will need
Spreadsheet App to create and access new sheets; and
Functions that manipulate cells here.
You can enter the formula via Apps Script as strings.
For example, say you want cell A1 to have formula B1+C1 in a tab named "Sheet1". You can do the following.
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var tab = sheet.getSheetByName('Sheet1');
sheet.setActiveSheet(tab);
var cell = tab.getRange(1, 1); // The arguments are the row and column indices of A1, respectively.
cell.setValue('=B1+C1');
There are many things you can do here with the basic template. You can generate sheets based on some naming convention. You can generate formula based on the cell position. You can create a script that fills in the formula upon the creation of a tab if its name observes a certain rule. etc etc. And naturally, you can duplicate the formulas from one sheet. You will need getFormula() as opposed to getValue.
Note: you can also call
custom Apps Script function directly in your sheet and write your cells using the output of your custom function. But in your case, using the range functions in Apps Script should be more efficient.

In Google Sheets, How do I find the row number of a cell with certain text in it?

In Google Sheets, What do I do if I want a cell to display the row number in which a certain word/line of text appears?
So, I'm working with two kinds of spreadsheets here: One has the number of "Competitors" (which I'm looking for) in the 7th row of the spreadsheet, while others might have it in a different row. To work around this inconsistency, I want to set up a cell function which outputs the row number of where ever the "Competitors" number is, and then concatenate that function into a reference for the correct row-number.
The tables that I'm looking in all have the labels in the first column
Here are some viewable links to the Sheets I'm working on:
https://docs.google.com/spreadsheets/d/1SS_Bk2FFGNnsxhhg3RQGflTSxEncAjD-CaQBtPjTIVM/edit?usp=sharing
https://docs.google.com/spreadsheets/d/1JJvbiYUYT3zb8OFwHoF1WaLmEGkwO4N7lLLeBqgWRcw/edit?usp=sharing
^Notice how "Competitors" is in row 7 in one sheet but in row 6 in the other. This is why I need to find a function which can find a reference to the row number of "Competitors"
Figured it out - To find the row numbers that the string "Competitors" was in, All I had to do was use the MATCH function like this:
=MATCH("Competitors", A:A,0)
The user #Jeeped told me about the "Match" function in a comment under his answer. Although Jeeped's answer did demonstrate the "MATCH" function, he presented it being used along side the "SUM" function, which confused me at first. Give thanks/upvotes to Jeeped for helping me find the solution in this :)

How to use arrayformula to dynamically join strings in google spreadsheet?

I use Arrayformula() to make my reports dynamic and easier to edit. For example, if I have a Column A with a list o number o blue balls in a set and a Column B with a list red balls in a set, on the cell C1 I can write =ArrayFormula(add(A1:A,B1:B)) and in the Column C will have the total of balls in each set. It would be exactly the same as writing =A1+B1 in cell C1 and dragging the formula down to the last row. Arrayformula() has some benefits, because it will work if some adds or removes rows from the sheet and also it makes the reports way more organized and easier to edit.
Since I´ve discovered arrayformula(), my life has changed, because of the fact that googleSheets expands the formula to other cells. It does not work every time, but the idea of expanding to other cells seems to be possible some way or another, here is a good example of a problem that was not resolved by arrayformula(), but has the same idea.
Keeping that idea in mind, imagine that on Column A there is a list of First Names and on Column B there is a list of Last names. On Column C I want to join this two string using a simples space. The way to do that would be in the cell C1 write =join(" ",A1,B1) and then drag down this formula. This method method however is prone to error since people can add and remove rows, deleting my formula. I want to use a formula that I can write in one single cell and it expands to other cells. I´ve tried =arrayformula(join(" ",A1:A,B1:B)), but it does not work.
Is that a way to do that using =arrayformula() or other native function?
I know I could write a script or custom formula to do that, but this is not my goal here.
I think this formula should work:
=arrayformula(A1:A&" "&B1:B)
In case you want to use a delimiter, you can do the following to have a clean result even though, A or B is not present in some cases:
ARRAYFORMULA(ifna(ifs(isblank(A1:A),,ISBLANK(B1:B),A1:A),A1:A&" - "&B1:B))

Resources