[Solved] Multiple formulas / priority / override?
[Solved] Multiple formulas / priority / override?
I'm not sure if this is possible, but I currently have my spreadsheet set up for certain cells to duplicate the contents of the cell above it i.e. "=INDIRECT(ADDRESS(ROW()-1;COLUMN();1))", but I would also like to add a function where if the E column contains "2" then display "NO-TAX", and override the "=INDIRECT(ADDRESS(ROW()-1;COLUMN();1))" function, and if it contains anything else to just continue with the =INDIRECT function as usual.
Is this somehow doable? Thanks
Is this somehow doable? Thanks
Last edited by swdistro on Fri Apr 29, 2022 3:53 am, edited 1 time in total.
OpenOffice 4.1.5 on Windows 7 Home Premium 64-bit
Re: Multiple formulas / priority / override?
https://wiki.openoffice.org/wiki/Docume ... X_function
https://wiki.openoffice.org/wiki/Docume ... H_function
https://wiki.openoffice.org/wiki/Docume ... T_function
and of course you know everything about[Tutorial] Absolute, relative and mixed references
https://wiki.openoffice.org/wiki/Docume ... H_function
https://wiki.openoffice.org/wiki/Docume ... T_function
and of course you know everything about[Tutorial] Absolute, relative and mixed references
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
- MrProgrammer
- Moderator
- Posts: 4905
- Joined: Fri Jun 04, 2010 7:57 pm
- Location: Wisconsin, USA
Re: Multiple formulas / priority / override?
Using that complicated formula suggests that you do not understand relative references, which is one of the most fundamental ideas in a spreadsheet. It will be difficult to use a spreadsheet effectively until you learn about this. Read section 8. Using formulas and cell references in Ten concepts that every Calc user should know.swdistro wrote:=INDIRECT(ADDRESS(ROW()-1;COLUMN();1))
Yes, of course. You can use the IF() function. If you need any additional assistance attach a document demonstrating the situation (remove confidential information then use Post Reply, not Quick Reply, and don't attach a picture instead of the document itself).swdistro wrote:I would also like to add a function where if the E column contains "2" then display "NO-TAX", and override the [other] function
If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the subject field. Select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
Re: Multiple formulas / priority / override?
Well, it's true. I got that formula from my last forum post on here a few months ago.MrProgrammer wrote:Using that formula suggests that you do not understand relative references, which is one of the most fundamental ideas in a spreadsheet. It will be difficult to use a spreadsheet effectively until you learn about this. Read section 8. Using formulas and cell references in Ten concepts that every Calc user should know.swdistro wrote:=INDIRECT(ADDRESS(ROW()-1;COLUMN();1))
I'll attach my document shortly.
OpenOffice 4.1.5 on Windows 7 Home Premium 64-bit
Re: Multiple formulas / priority / override?
You can always amend your formula so that it becomes part of an IF function, similar to how you get NO TAX to display when the entry in column E is a 2
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
Re: Multiple formulas / priority / override?
Okay, here is a different approach that suits the situation better:
I need:
IF K2 equals one of the following:
BC
AB
SK
MB
ON
QC
NB
NS
NL
PEI
NVT
YT
NWT
Then display whatever of those is in K2.
If it is anything else, display NO-TAX.
AND as a priority over all of that, if E2 equals 2 (not contains, as there are other larger numbers that might have 2 in it, it needs to be "2" and "2' alone), then also NO-TAX, even if K2 contains any of the above letters.
I need:
IF K2 equals one of the following:
BC
AB
SK
MB
ON
QC
NB
NS
NL
PEI
NVT
YT
NWT
Then display whatever of those is in K2.
If it is anything else, display NO-TAX.
AND as a priority over all of that, if E2 equals 2 (not contains, as there are other larger numbers that might have 2 in it, it needs to be "2" and "2' alone), then also NO-TAX, even if K2 contains any of the above letters.
OpenOffice 4.1.5 on Windows 7 Home Premium 64-bit
Re: Multiple formulas / priority / override?
I think this formula meets your needs. I stored the 13 abbreviations in the cell range M1:M13. You can put them anywhere that is convenient and edit the formula accordingly.
Explaining that from the inside out:
MATCH() looks for the content of K2 in the range M1:M13. If it finds it, it returns a number. If it does not find it, it returns #N/A. The ISNA() returns TRUE or FALSE depending on what MATCH did. TRUE means MATCH did not find the text. The OR() checks whether ISNA is TRUE or E2 = 2. If either of those is TRUE, OR returns TRUE. If the OR is TRUE, the IF() returns NO-TAX, otherwise, it returns whatever is in K2.
Code: Select all
=IF(OR(ISNA(MATCH(K2;$M$1:$M$13;0));E2 = 2);"NO-TAX";K2)
MATCH() looks for the content of K2 in the range M1:M13. If it finds it, it returns a number. If it does not find it, it returns #N/A. The ISNA() returns TRUE or FALSE depending on what MATCH did. TRUE means MATCH did not find the text. The OR() checks whether ISNA is TRUE or E2 = 2. If either of those is TRUE, OR returns TRUE. If the OR is TRUE, the IF() returns NO-TAX, otherwise, it returns whatever is in K2.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Re: Multiple formulas / priority / override?
That works perfectly, thank you.FJCC wrote:I think this formula meets your needs. I stored the 13 abbreviations in the cell range M1:M13. You can put them anywhere that is convenient and edit the formula accordingly.Explaining that from the inside out:Code: Select all
=IF(OR(ISNA(MATCH(K2;$M$1:$M$13;0));E2 = 2);"NO-TAX";K2)
MATCH() looks for the content of K2 in the range M1:M13. If it finds it, it returns a number. If it does not find it, it returns #N/A. The ISNA() returns TRUE or FALSE depending on what MATCH did. TRUE means MATCH did not find the text. The OR() checks whether ISNA is TRUE or E2 = 2. If either of those is TRUE, OR returns TRUE. If the OR is TRUE, the IF() returns NO-TAX, otherwise, it returns whatever is in K2.
If there is a way that it can be done without needing that extra range (e.g. your M1:M13) that would be ideal, but if not I can absolutely work with this.
OpenOffice 4.1.5 on Windows 7 Home Premium 64-bit
Re: Multiple formulas / priority / override?
This also works, if you strongly want to avoid using an external range.
If you ever want to adjust the list and the formula is in several cells, it will be painful and prone to error.
Code: Select all
=IF(OR(ISNA(MATCH(K2;{"BC";"AB";"SK";"MB";"ON";"QC";"NB";"NS";"NL";"PEI";"NVT";"YT";"NWT"};0));E2 = 2);"NO-TAX";K2)
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Re: Multiple formulas / priority / override?
That'll do!FJCC wrote:This also works, if you strongly want to avoid using an external range.If you ever want to adjust the list and the formula is in several cells, it will be painful and prone to error.Code: Select all
=IF(OR(ISNA(MATCH(K2;{"BC";"AB";"SK";"MB";"ON";"QC";"NB";"NS";"NL";"PEI";"NVT";"YT";"NWT"};0));E2 = 2);"NO-TAX";K2)
The formula will only ever be in the Q column rage, the list is just the provinces of Canada, and the only thing that will force NO-TAX other than a non-Canadian province will be "2" in E2, so this should work out in perpetuity. Any changes I can then just drop into Q2 and drag through the length of the column.
I'd consider this now solved. Thank you very much!
OpenOffice 4.1.5 on Windows 7 Home Premium 64-bit
Re: [SOLVED] Multiple formulas / priority / override?
What if Canada annexes Minnesota?
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.