[Solved] Multiple IF statements

Discuss the spreadsheet application
Locked
phillmold
Posts: 6
Joined: Sat Jun 22, 2024 12:48 pm

[Solved] Multiple IF statements

Post by phillmold »

In column c starting with 26 going to c32 I have a range from 8 down to 1.26, I want in column e for those 7 and over, '0.00', from 6 to 6.999 "20.00" from 5 to 5.999 "40.00" from 4 to 4.9999 "60.00", from 3 to 3.999 "80.00" and <3 "100.00"

Its been a few years since I did things like this and then it was in excell, can anyone show me how to write the if statement please before I remove the rest of my hair?
Last edited by MrProgrammer on Wed Jun 26, 2024 12:23 am, edited 2 times in total.
Reason: Tagged ✓ [Solved] -- MrProgrammer, forum moderator
OpenOffice 3.1 on Windows 11
User avatar
MrProgrammer
Moderator
Posts: 5430
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Multiple IF statements

Post by MrProgrammer »

phillmold wrote: Sat Jun 22, 2024 1:04 pm In column c starting with 26 going to c32 I have a range from 8 down to 1.26, I want in column e for those 7 and over, '0.00', from 6 to 6.999 "20.00" from 5 to 5.999 "40.00" from 4 to 4.9999 "60.00", from 3 to 3.999 "80.00" and <3 "100.00"
Do not use IF(). Use VLOOKUP(). Read how to use this important spreadsheet function.
[Tutorial] VLOOKUP questions and answers

If you need any additional assistance attach a spreadsheet demonstrating the difficulty (remove confidential information then use Post Reply, not Quick Reply, and don't attach a picture instead of the spreadsheet itself). I will not help further unless you attach.

phillmold wrote: Sat Jun 22, 2024 1:04 pm can anyone show me how to write the if statement
Calc does not use statements. Excel does not use statements. No spreadsheets have statements. They use functions to perform calculations. IF() and VLOOKUP() are both functions.

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.

[Tutorial] Ten concepts that every Calc user should know
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.8, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
FJCC
Moderator
Posts: 9624
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Multiple IF statements

Post by FJCC »

I think you can use a VLOOKUP() function. Take a look at the example in the attached document. I made a look up table starting in cell G1, the VLOOKUP functions are in column E and the values to be looked up are in column C.
Attachments
VLOOKUP.ods
(8.62 KiB) Downloaded 69 times
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.
phillmold
Posts: 6
Joined: Sat Jun 22, 2024 12:48 pm

Re: Multiple IF statements

Post by phillmold »

Thank you, I think I am nearly there, but still struggling.

My data is in column E, rows 26 to 32.
the values to be looked up are in column F row 26 to 33, integers 0 to 7 inclusive
in column g is a factor to be pasted into column H rows 26 to 32 for each of the entries in E 26 to E32.

6	0	100	Err:511
5	1	100	
5	2	100	
2	3	80	
1	4	60	
0	5	40	
0	6	20	
	7	0
Last edited by MrProgrammer on Sun Jun 23, 2024 4:04 pm, edited 1 time in total.
Reason: Add formatting tags to table
OpenOffice 3.1 on Windows 11
FJCC
Moderator
Posts: 9624
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Multiple IF statements

Post by FJCC »

Please upload the Calc file or a minimized version of it that illustrates the problem. To upload a file, click Post Reply and look for the Attachments tab just below the box where you type a response.
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.
phillmold
Posts: 6
Joined: Sat Jun 22, 2024 12:48 pm

Re: Multiple IF statements

Post by phillmold »

Gifts from parents.ods
(14.59 KiB) Downloaded 73 times
OpenOffice 3.1 on Windows 11
FJCC
Moderator
Posts: 9624
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Multiple IF statements

Post by FJCC »

Does the formula in H26 now do what you want?
Attachments
Gifts from parents_fjcc.ods
(14.69 KiB) Downloaded 63 times
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.
phillmold
Posts: 6
Joined: Sat Jun 22, 2024 12:48 pm

Re: Multiple IF statements

Post by phillmold »

MrProgrammer wrote: Sat Jun 22, 2024 2:47 pm
phillmold wrote: Sat Jun 22, 2024 1:04 pm In column c starting with 26 going to c32 I have a range from 8 down to 1.26, I want in column e for those 7 and over, '0.00', from 6 to 6.999 "20.00" from 5 to 5.999 "40.00" from 4 to 4.9999 "60.00", from 3 to 3.999 "80.00" and <3 "100.00"
Do not use IF(). Use VLOOKUP().
[Tutorial] VLOOKUP questions and answers

If you need any additional assistance attach a spreadsheet demonstrating the difficulty (remove confidential information then use Post Reply, not Quick Reply, and don't attach a picture instead of the spreadsheet itself). I will not help further unless you attach.

phillmold wrote: Sat Jun 22, 2024 1:04 pm can anyone show me how to write the if statement
Calc does not use statements. Excel does not use statements. No spreadsheets have statements. They use functions to perform calculations. IF() and VLOOKUP() are both functions.

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.

[Tutorial] Ten concepts that every Calc user should know
Sorry for not using the words correctly.
I did say the last time I did something like this was over 20 years ago.
Until this thread I had never heard of VLOOK UP and now several days later I still cannot get it to work.
Sorry for being so thick
OpenOffice 3.1 on Windows 11
phillmold
Posts: 6
Joined: Sat Jun 22, 2024 12:48 pm

Re: Multiple IF statements

Post by phillmold »

PS
I have now done it. Using mi=utliple "IF" statemements.............
OpenOffice 3.1 on Windows 11
FJCC
Moderator
Posts: 9624
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Multiple IF statements

Post by FJCC »

Did you see my example document posted your previous reply?
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.
phillmold
Posts: 6
Joined: Sat Jun 22, 2024 12:48 pm

Re: Multiple IF statements

Post by phillmold »

Yes, but I could/cannot get vlookup to work so resoreted to to "IF"
OpenOffice 3.1 on Windows 11
Locked