If then to change cell value?

4 replies [Last post]
Lazlow
Offline
Last seen: 1 week 5 days ago
Title:
Joined: 16 May 2016
Posts: 2
Hey Guys

It has been a while since I used a spreadsheet much, so I may have just missed something basic.

Ok, so I have cells g9 and g11 that both depend on cell c25. When g9>g11 I want to c25=c25+1. How do I make this happen?

Thanks in advance
Lazlow

mark_t
Offline
Last seen: 8 hours 17 min ago
Title: ★★★★
Joined: 26 Apr 2016
Posts: 90
I don’t think you could set
I don’t think you could set C25 = C25 + 1 from the spreadsheet functions, that would create a cyclic reference.

You could put “=IF(G11>G12,1,0)” into C25, but that would only give 0 or 1.

Or possibly “=C24 + IF(G11>G12,1,0)”, if C24 was a previous count result.

LibreOffice 5.1.3.2, Windows 8.1
Lupp
Lupp's picture
Offline
Last seen: 1 day 16 hours ago
Title: ★★★★★
Joined: 1 Aug 2012
Posts: 1515
Concerning the basic principles of spreadsheets
Lazlow wrote:
…I have cells g9 and g11 that both depend on cell c25. When g9>g11 I want to c25=c25+1…
It’s a basic rule that any spreadsheet cell has to get its value (number or text) either by the user entering a constant or by a formula placed in exactly this cell and returning the value as its result. So called macros may break the rule. How did C25 get its original value G9 and G11 depended on? If that value was calculated by a formula there may be a way get what you want. No general advice possible, I’m afraid. Attach an example exactly demonstrating you problem, please.

Currently installed: LibO V5.1.2 on Windows 10
Maybe we might! (Create a powerful UFO: United Free Office!) Lupp from München
Lazlow
Offline
Last seen: 1 week 5 days ago
Title:
Joined: 16 May 2016
Posts: 2
I goofed. g9 does not depend
I goofed. g9 does not depend on c25.

The initial number was manually entered. This is for building a wind turbine. G9 is the watts in the wind at a given wind speed. G11 is the watts the generator will produce at that same wind speed. If the generator is producing more watts than is in the wind, it means it has stalled. If you raise the voltage(c26) the wattage of the generator drops, repeat until stall is over. So the battery voltage (or MPPT voltage) changes for every wind speed.

So they both depend on wind speed and diameter of turbine. I guess I could build a table of voltages (40-250), calculate for each, and then compare g9 to each. That seems pretty messy though.

Thanks

mark_t
Offline
Last seen: 8 hours 17 min ago
Title: ★★★★
Joined: 26 Apr 2016
Posts: 90
You might be able to use
You might be able to use VLOOKUP to search a sorted table of two columns, this could compare G9 with the first column for the closest match and return the value from the second column.

=VLOOKUP ( G9,A1:B9,2,1 )

LibreOffice 5.1.3.2, Windows 8.1

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.