[Solved] I need a IF, AND, THEN function

Discuss the spreadsheet application
Post Reply
bulletbobb2
Posts: 37
Joined: Sun Sep 13, 2009 5:22 pm

[Solved] I need a IF, AND, THEN function

Post by bulletbobb2 »

Say that column A holds the numbers 1 thru 10.
In column B I want to put an 8 if the number in column A is between 4 and 6, otherwise I want to insert a 7.
I tried this with an IF function, but can't get it to work.
This is really involved with the NBA,time zones and DST. For a game during DST the column gets a 7, during ST it gets an 8, then later in the season a 7 again.
Any ideas?

Thanks,

Bob
Last edited by Hagar Delest on Mon Nov 05, 2012 4:59 pm, edited 1 time in total.
Reason: tagged [Solved].
OpenOffice 2.4 on Windows XP
User avatar
karolus
Volunteer
Posts: 1159
Joined: Sat Jul 02, 2011 9:47 am

Re: I need a IF, AND, THEN function

Post by karolus »

Hallo

Code: Select all

=7+((A1>=4)*(A1<=6))
Pull down

Karolus
AOO4, Libreoffice 6.1 on Rasbian OS (on ARM)
Libreoffice 7.4 on Debian 12 (Bookworm) (on RaspberryPI4)
Libreoffice 7.6 flatpak on Debian 12 (Bookworm) (on RaspberryPI4)
User avatar
MrProgrammer
Moderator
Posts: 4903
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: I need a IF, AND, THEN function

Post by MrProgrammer »

bulletbobb2 wrote:I tried this with an IF function, but can't get it to work.
There's an example of using IF and AND near the bottom of section 9. Using functions and cell ranges in Ten concepts that every Calc user should know.
karolus wrote:Pull down
Specifically, enter the formula in the first row of column B, then Fill the formula down the column.
bulletbobb2 wrote:Say that column A holds the numbers 1 thru 10. … if the number in column A is between 4 and 6
Do you mean "if the number is 4, 5, or 6"? I would say that 5 is the only number among 1,2,3,4,5,6,7,8,9,10 that is "between" 4 and 6. Choose your words carefully or you may get incorrect advice.

If this answered your question please go to your first post use the Edit button and add [Solved] to the start of the title. You can 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).
bulletbobb2
Posts: 37
Joined: Sun Sep 13, 2009 5:22 pm

Re: I need a IF, AND, THEN function

Post by bulletbobb2 »

I meant 4,5, or 6.
I figured it out myself using an AND function, but karolus' idea seems simpler, so I'll have to try it.
Many thanks.

Bob
OpenOffice 2.4 on Windows XP
Post Reply