+ Reply to Thread
Results 1 to 22 of 22

Combine IF statements and display results seperately

  1. #1
    Registered User
    Join Date
    07-27-2016
    Location
    Fort Smith, AR
    MS-Off Ver
    Office 2016
    Posts
    14

    Question Combine IF statements and display results seperately

    I'm making a random weather generator for a game and I'm wanting it to combine the temperature, rainfall and wind formulas into one and have the results display as: XX*F with 0.XX'' precipitation and XXmph winds
    I'm not sure if this is even possible, but I figure if it is, someone here will know. Thanks in advance for any help.

    Temperature (Currently displays as XX*F):

    Precipitation (Currently displays as X.XX"):

    =IF(RANDBETWEEN(1,100)<41,RANDBETWEEN(5,10)/100,0)

    Wind (Currently displays as XXmph):

    =IF('[Random Weather.xlsx]Reference'!AC2<71,RANDBETWEEN(0,10),IF('[Random Weather.xlsx]Reference'!AC2<81,RANDBETWEEN(11,20),IF('[Random Weather.xlsx]Reference'!AC2<91,RANDBETWEEN(21,30),IF('[Random Weather.xlsx]Reference'!AC2<99,RANDBETWEEN(31,50),IF('[Random Weather.xlsx]Reference'!AC2<100,RANDBETWEEN(51,74),RANDBETWEEN(175,300))))))

    There are 72 variations of each of these formulas (based on location and date), so if you do know a way to combine the formulas and make the results display in the desired manner, hopefully you know a trick to quickly do so? The goal here is to clean up the sheet. In total each of the 72 variations is used 84 times for 6048 formulas and results.

    As a separate but equal situation, I'd like to narrow this whole spreadsheet even further. Ideally, my end result would all you to enter a season (Spring, Summer, Autumn, Winter) and a Biome (Tundra, Plains, Evergreen Forest, Desert, Deciduous Forest, Jungle, Glacial Coast, Coast, Tropical Coast, Arctic Mountains, Mountains, Tropic Peaks, Rolling Tundra, Highlands, Plateaus, Boreal Bog, Swamp, Cloud Forest) and the Temperature, Precipitation, and Wind Speed be displayed. I understand that essentially this is a huge series of IF formulas, but I'm not sure if Excel would allow me to string that many together. If anyone would like to give me a hand with this, let me know and I'll post all the formulas.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2407 (Windows 11 23H2 64-bit)
    Posts
    82,933

    Re: Combine IF statements and display results seperately

    Welcome! Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    07-27-2016
    Location
    Fort Smith, AR
    MS-Off Ver
    Office 2016
    Posts
    14

    Re: Combine IF statements and display results seperately

    Whoops, forgot the Temperature formula!

    =IF('[Random Weather.xlsx]Reference'!Y2<71,ROUNDUP(RANDBETWEEN(28,33),0),IF('[Random Weather.xlsx]Reference'!Y2<86,ROUNDUP(RANDBETWEEN(22,27),0),ROUNDUP(RANDBETWEEN(33,39),0)))

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2407 (Windows 11 23H2 64-bit)
    Posts
    82,933

    Re: Combine IF statements and display results seperately

    Please provide the workbook, as requested in post #2.

  5. #5
    Registered User
    Join Date
    07-27-2016
    Location
    Fort Smith, AR
    MS-Off Ver
    Office 2016
    Posts
    14

    Re: Combine IF statements and display results seperately

    I think I attached a mock up this time. If the mock up is not clear, let me know. Thanks.
    Attached Files Attached Files

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2407 (Windows 11 23H2 64-bit)
    Posts
    82,933

    Re: Combine IF statements and display results seperately

    I'm perplexed. Where do these temperature values come from in AFTER #1? They do not seem to match those in BEFORE #1.

    Environment Weather
    Tundra 29°F with 0.00" Precipitation and 19mph winds.
    Plains 27°F with 0.00'' Precipitation and 3mph winds.
    Evergreen 57°F with 0.00'' Precipitation and 10mph winds.
    Desert 105°F with 0.08'' Precipitation and 9mph winds.
    Deciduous Forest 69°F with 0.00'' Precipitation and 7mph winds.
    Jungle 72°F with 0.00'' Precipitation and 7mph winds.
    Glacial Coast 24°F with 0.00'' Precipitation and 17mph winds.
    Coast 34°F with 0.23'' Precipitation and 19mph winds.


    They

  7. #7
    Registered User
    Join Date
    07-27-2016
    Location
    Fort Smith, AR
    MS-Off Ver
    Office 2016
    Posts
    14

    Re: Combine IF statements and display results seperately

    Because the Temperature values, amount of Precipitation and Wind Speeds are all randomly generated each time, I just entered them as they were currently displayed (changing every time I finished one line). Essentially though, it would be

    Environment Weather
    Tundra XX°F with X.XX'' Precipitation and XXmph winds.
    Plains XX°F with X.XX'' Precipitation and XXmph winds.
    Evergreen XX°F with X.XX'' Precipitation and XXmph winds.
    Desert XX°F with X.XX'' Precipitation and XXmph winds.
    Deciduous Forest XX°F with X.XX'' Precipitation and XXmph winds.
    Jungle XX°F with X.XX'' Precipitation and XXmph winds.
    Glacial Coast XX°F with X.XX'' Precipitation and XXmph winds.
    Coast XX°F with X.XX'' Precipitation and XXmph winds.

    Where XX is found using the formula appropriate to the Environment listed in BEFORE #1, X.XX"

  8. #8
    Registered User
    Join Date
    07-27-2016
    Location
    Fort Smith, AR
    MS-Off Ver
    Office 2016
    Posts
    14

    Re: Combine IF statements and display results seperately

    Apologies, but it is 5:50 AM here and I've been up since 4:00 AM yesterday, so I'm a little tired and may have overlooked something when I made the mock up.

  9. #9
    Registered User
    Join Date
    07-27-2016
    Location
    Fort Smith, AR
    MS-Off Ver
    Office 2016
    Posts
    14

    Re: Combine IF statements and display results seperately

    Another way to put it is that I want to know if it is possible to get the results {{It is =IF('[Random Weather.xlsx]Reference'!A65<71,ROUNDUP(RANDBETWEEN(28,33),0),IF('[Random Weather.xlsx]Reference'!A65<86,ROUNDUP(RANDBETWEEN(22,27),0),ROUNDUP(RANDBETWEEN(33,39),0)))°F with =IF(RANDBETWEEN(1,100)<41,RANDBETWEEN(5,10)/100,0)'' and =IF('[Random Weather.xlsx]Reference'!E65<71,RANDBETWEEN(0,10),IF('[Random Weather.xlsx]Reference'!E65<81,RANDBETWEEN(11,20),IF('[Random Weather.xlsx]Reference'!E65<91,RANDBETWEEN(21,30),IF('[Random Weather.xlsx]Reference'!E65<99,RANDBETWEEN(31,50),IF('[Random Weather.xlsx]Reference'!E65<100,RANDBETWEEN(51,74),RANDBETWEEN(175,300))))))mph winds}} to display in a single cell with the formulas actually displaying the results they would calculate.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2407 (Windows 11 23H2 64-bit)
    Posts
    82,933

    Re: Combine IF statements and display results seperately

    You are not making yourself at all clear to me, I'm sorry to say. I'm going to have to pass on this one. Hopefully someone else will have a clue about what you are trying to achieve. Sorry!

  11. #11
    Registered User
    Join Date
    07-27-2016
    Location
    Fort Smith, AR
    MS-Off Ver
    Office 2016
    Posts
    14

    Re: Combine IF statements and display results seperately

    Alright, thanks for trying.

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2407 (Windows 11 23H2 64-bit)
    Posts
    82,933

    Re: Combine IF statements and display results seperately

    Actually, try this in B1 of AFTER#1 copied down and let us know if it's what you are after:

    ='BEFORE #1'!B2&"°F with "&'BEFORE #1'!C2&"''"&" Precipitation and "&'BEFORE #1'!D2&"mph winds."

    If not, then you need to try to explain again, in simple and formula-free terms, what you are trying to do.

  13. #13
    Registered User
    Join Date
    07-27-2016
    Location
    Fort Smith, AR
    MS-Off Ver
    Office 2016
    Posts
    14

    Re: Combine IF statements and display results seperately

    That is the exact solution I was looking for to solve the first issue I was having. Thank you very much!

  14. #14
    Registered User
    Join Date
    07-27-2016
    Location
    Fort Smith, AR
    MS-Off Ver
    Office 2016
    Posts
    14

    Re: Combine IF statements and display results seperately

    My second issue is a basic parsing issue with IF formulas. I'm trying to combine a series IF formulas that are in separate cells into a single long IF formula. Here are four of the IF formulas I'm trying to combine.

    =IF(A2="Tundra, Spring",IF(Reference!A2<71,ROUNDUP(RANDBETWEEN(28,33),0),IF(Reference!A2<86,ROUNDUP(RANDBETWEEN(22,27),0),ROUNDUP(RANDBETWEEN(33,39),0))))

    =IF(A2="Tundra, Summer",IF(Reference!E2<71,ROUNDUP(RANDBETWEEN(55,72),0),IF(Reference!E2<91,ROUNDUP(RANDBETWEEN(42,54),0),ROUNDUP(RANDBETWEEN(73,85),0))))

    =IF(A2="Tundra, Autumn",IF(Reference!F2<71,ROUNDUP(RANDBETWEEN(-32,-15),0),IF(Reference!F2<86,ROUNDUP(RANDBETWEEN(-43,-31),0),ROUNDUP(RANDBETWEEN(-14,-3),0))))

    =IF(A2="Tundra, Winter",IF(Reference!G2<71,ROUNDUP(RANDBETWEEN(-48,-30),0),IF(Reference!G2<81,ROUNDUP(RANDBETWEEN(-58,-47),0),ROUNDUP(RANDBETWEEN(-29,-18),0))))

    The end goal is that I want to be able to use a drop down list to select a "Biome, Season" and get the results based on that. I'll attach a mock up below, hopefully this one will be clearer.
    Attached Files Attached Files

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2407 (Windows 11 23H2 64-bit)
    Posts
    82,933

    Re: Combine IF statements and display results seperately

    Quote Originally Posted by SzassT View Post
    That is the exact solution I was looking for to solve the first issue I was having. Thank you very much!
    Ah, excellent!

  16. #16
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2407 (Windows 11 23H2 64-bit)
    Posts
    82,933

    Re: Combine IF statements and display results seperately

    On the second challenge, in After, this in B2:

    =INDEX(Before!$B$3:$E$20,MATCH(LEFT(After!A2,FIND(",",After!A2)-1),Before!$A$3:$A$20,0),MATCH(RIGHT(After!A2,LEN(A2)-FIND(",",After!A2)-1),Before!$B$2:$E$2,0))

    This in C2:

    =INDEX(Before!$J$3:$J$20,MATCH(LEFT(After!A2,FIND(",",After!A2)-1),Before!$A$3:$A$20,0),1)

    And this in D2:

    =INDEX(Before!$K$3:$K$20,MATCH(LEFT(After!A2,FIND(",",After!A2)-1),Before!$A$3:$A$20,0),1)

  17. #17
    Registered User
    Join Date
    07-27-2016
    Location
    Fort Smith, AR
    MS-Off Ver
    Office 2016
    Posts
    14

    Re: Combine IF statements and display results seperately

    New issue

    With nesting all the Biome/Season temperatures together, I realized I will need a total of 216 nested IF formulas and it is my understanding that there is a maximum of 64 nested IF formulas. If I divide it into 4 sections, one section for each Season, then I need 72 nest IF functions per Season. Is there any way around these limitations? If not, this issue cannot be resolved.

  18. #18
    Registered User
    Join Date
    07-27-2016
    Location
    Fort Smith, AR
    MS-Off Ver
    Office 2016
    Posts
    14

    Re: Combine IF statements and display results seperately

    I didn't see your reply yet, disregard the "New Issue" until I test your solution.

  19. #19
    Registered User
    Join Date
    07-27-2016
    Location
    Fort Smith, AR
    MS-Off Ver
    Office 2016
    Posts
    14

    Re: Combine IF statements and display results seperately

    Wow, you're great! Thank you so much. You just resolved an issue I've been working on for 2 days in a matter of hours!

  20. #20
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2407 (Windows 11 23H2 64-bit)
    Posts
    82,933

    Re: Combine IF statements and display results seperately

    Quote Originally Posted by SzassT View Post
    I didn't see your reply yet, disregard the "New Issue" until I test your solution.
    You need to start reading up about the VLOOKUP and INDEX MATCH functions. Forget about nested IFs.

  21. #21
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2407 (Windows 11 23H2 64-bit)
    Posts
    82,933

    Re: Combine IF statements and display results seperately

    Quote Originally Posted by SzassT View Post
    Wow, you're great! Thank you so much. You just resolved an issue I've been working on for 2 days in a matter of hours!
    I'm glad to have helped, but it wasn't easy sifting through the chaff!!! Hopefully what I have shown you here will help you with other projects in the future.

  22. #22
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2407 (Windows 11 23H2 64-bit)
    Posts
    82,933

    Re: Combine IF statements and display results seperately

    Thanks for the rep!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How do I only display formula results ONLY if there's results to display, and not just N/A
    By erikaberglund in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-23-2015, 02:38 PM
  2. [SOLVED] Combine 2 if statements
    By cartica in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-15-2014, 10:08 AM
  3. [SOLVED] Trying to combine If statements
    By jacap in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-09-2014, 01:26 PM
  4. [SOLVED] Display search results inluding results that match patrially
    By RichTea88 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-06-2013, 08:52 AM
  5. Need to combine several IF statements together
    By SumTuck in forum Excel General
    Replies: 7
    Last Post: 06-12-2012, 12:25 PM
  6. [SOLVED] Unable to display mail merge results using Preview Results function
    By trandle in forum Word Formatting & General
    Replies: 1
    Last Post: 05-30-2012, 12:29 AM
  7. How to combine two IF statements together.
    By foad in forum Excel General
    Replies: 7
    Last Post: 03-13-2009, 05:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1